scripting


scripting - In a Bash script, how can I exit the entire script if a certain condition occurs?

Try this statement: exit 1 Replace 1 with appropriate error codes. See also Exit Codes With Special Meanings.... Read More


How to execute an .SQL script file using c#

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.SqlServer.Management.Smo; using Microsoft.Sq... Read More


shell - How to mkdir only if a directory does not already exist

Try mkdir -p: mkdir -p foo Note that this will also create any intermediate directories that don't exist; for instance, mkdir -p foo/bar/baz will create directories foo, foo/bar, and foo/bar/baz if... Read More


scripting - Determine if current PowerShell Process is 32-bit or 64-bit?

If you're shell is running on .NET 4.0 (PowerShell 3.0): PS> [Environment]::Is64BitProcess True... Read More


Grep and Sed Equivalent for XML Command Line Processing

I've found xmlstarlet to be pretty good at this sort of thing. http://xmlstar.sourceforge.net/ Should be available in most distro repositories, too. An introductory tutorial is here: http://www.ibm.... Read More


linux - How do I get cURL to not show the progress bar?

curl -s http://google.com > temp.html works for curl version 7.19.5 on Ubuntu 9.10 (no progress bar). But if for some reason that does not work on your platform, you could always redirect stderr to... Read More


ssh - Automatically (or more easily) reconnect to a screen session after network interruption

Does the -t option do what you want? -t Force pseudo-tty allocation. This can be used to execute arbi- trary screen-based programs on a remote machine, which can be ve... Read More


How can you find and replace text in a file using the Windows command-line environment?

A lot of the answers here helped point me in the right direction, however none were suitable for me, so I am posting my solution. I have Windows 7, which comes with PowerShell built-in. Here is the s... Read More


macos - Date command does not follow Linux specifications (Mac OS X Lion)

This is because OSX and Linux use two different sets of tools. Linux uses the GNU version of the date command (hence, GNU/Linux). Remember that Linux is Linux and OS X is Unix. They're different. You... Read More


macos - How to run a shell script in OS X by double-clicking?

First in terminal make the script executable by typing: chmod a+x (yourscriptname) Then, in Finder, right-click your file and select "Open with" and then "Other...". Here you select the application... Read More