Recent Notes

Displaying keyword search results 1 - 3
Created by magnum on September 11, 2012 11:59:43    Last update: September 11, 2012 11:59:43
Exerpt from bash documentation. HISTORY EXPANSION The bash shell supports a history expansion feature that is similar to the history expansion in csh. This feature is enabled by default for interactive shells, and can be disabled using the +H option to the set builtin command. Non-interactive shells do not perform history expansion by default. History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly. History expansion is performed immediately after a complete line is read, before the shell breaks it into words. It takes place in two parts. The first is to determine which line from the history...
Created by Dr. Xi on June 13, 2011 15:05:27    Last update: June 13, 2011 15:10:24
When you pass parameters from shell to Java, the list arguments may be messed up if there are spaces in the values. Start with a simple Java test class: public class EchoParams { public static voi... Tests: $ java EchoParams a b c Arg: a Arg: b Arg... Now wrap the command in a shell script ( echoparams.sh ): #!/bin/sh java EchoParams $* Tests: $ ./echoparams.sh a b c Arg: a Arg: b Arg... The quotes had no effect on the parameters list. Changing $* to $@ produces the same results. The correct way to quote the args list is: "$@" #!/bin/sh java EchoParams "$@" Test: $ ./echoparams.sh a b "c d" "1 2 3 4 5" Arg: a ...
Created by Dr. Xi on September 29, 2008 23:03:40    Last update: September 29, 2008 23:04:08
Variables set automatically by shell: Variable Description $# Number of command-line arguments. $- Options currently in effect (arguments supplied to sh or to set). $? Exit value of last executed command. $$ Process number of current process. $! Process number of last background command. $0 First word; that is, command name. $n Individual arguments on command line (positional parameters). The Bourne shell allows only nine parameters to be referenced directly (n = 1-9); the Korn shell allows n to be greater than 9 if specified as ${n}. $* All arguments on command line ("$1 $2..."). $@ All arguments on command line, individually quoted ("$1" "$2" ...). Variables set automatically by Korn shell: Variable Description ERRNO Error number of last system call that failed. LINENO Current...