Batch files – number of command line arguments
Googling a bit gives you the following result from wikibooks: set argC=0 for %%x in (%*) do Set /A argC+=1 echo %argC% Seems like cmd.exe has evolved a bit from the old DOS days 🙂
Googling a bit gives you the following result from wikibooks: set argC=0 for %%x in (%*) do Set /A argC+=1 echo %argC% Seems like cmd.exe has evolved a bit from the old DOS days 🙂
no need to launch sub shell. Use a code block will do as well. { time ls; } 2> out.txt or { time ls > /dev/null 2>&1 ; } 2> out.txt
bash –rcfile <(echo ‘. ~/.bashrc; some_command’) dispenses the creation of temporary files. Question on other sites: https://serverfault.com/questions/368054/run-an-interactive-bash-subshell-with-initial-commands-without-returning-to-the https://unix.stackexchange.com/questions/123103/how-to-keep-bash-running-after-command-execution
You can also use the cygwin utility: cygstart <your file> To make things OSX-like add the following to your bashrc alias open=’cygstart’ Don’t forget to check out the man page for cygstart.
In bash you can use set -e and set -o pipefail at the beginning of your file. A subsequent command ./a | ./b | ./c will fail when any of the three scripts fails. The return code will be the return code of the first failed script. Note that pipefail isn’t available in standard sh.
grep -Fx ABB.log a.tmp From the grep man page: -F, –fixed-strings Interpret PATTERN as a (list of) fixed strings -x, –line-regexp Select only those matches that exactly match the whole line.
You need to run the script as source or the shorthand . source ./myscript.sh or . ./myscript.sh This will run within the existing shell, ensuring any variables created or modified by the script will be available after the script completes. Running the script just using the filename will execute the script in a separate subshell.
The Algorithmic details of UNIX Sort command says Unix Sort uses an External R-Way merge sorting algorithm. The link goes into more details, but in essence it divides the input up into smaller portions (that fit into memory) and then merges each portion together at the end.
First things first, hover the mouse over the grey area below. Not part of the answer, but absolutely has to be said: If you have a shell script that does “checkout, build, deploy” all by itself, then why are you using Jenkins? You are foregoing all the features of Jenkins that make it what it … Read more
The solution is to use -O -J -O, –remote-name Write output to a file named as the remote file -J, –remote-header-name Use the header-provided filename So… curl -O -J ‘http://oregondigital.org/cgi-bin/showfile.exe?CISOROOT=/baseball&CISOPTR=0′ I had to upgrade my CURL. I had v 7.19 which doesn’t support -J but 7.22 (which is the latest) does.