Displaying keyword search results 1 - 2
Created by Dr. Xi on February 28, 2011 12:29:19 Last update: February 28, 2011 12:30:40
The Unix shell passes these parameters to the shell script: Variable Meaning $* A single string representing all command line arguments separated by $IFS (internal field separator, usually a space) $@ A sequence of strings representing the command line arguments. $1,$2...$n $1 is the first argument, $2 is the second argument, and so on... $0 The name of the script itself. $# The number of arguments. Example shell script ( sharg.sh ):
#!/bin/sh echo $# arguments passed to $0: $@ ...Output for ./sharg.sh "a b c d" :
1 arguments passed to ./sharg.sh: a b c d here ...Output for ./sharg.sh a "b c" d :
3 arguments passed to ./sharg.sh: a b c d here ...
Created by Dr. Xi on December 04, 2009 04:33:05 Last update: December 04, 2009 04:33:05
Variable Meaning $_ The default or implicit variable. @_ Within a subroutine the array @_ contains the parameters passed to that subroutine. $a, $b Special package variables when using sort() $<digit> Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already. $. Current line number for the last filehandle accessed. $/ The input record separator, newline by default. $| If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only whether you've asked Perl explicitly to flush after...