|
|
Variable
Substitution
variables
| Substitution |
Description |
$var
${var} |
These
are replaced by words from the value of var, each separated by a space
character. If var is an environment variable, its value is returned (but
‘:’ modifiers and the other forms given below are not available). |
$var[index]
${var[index]} |
These
select only the indicated words from the value of var. Variable substitution
is applied to index, which may consist of (or result in) a either single
number, two numbers separated by a ‘-‘, or an asterisk. Words are indexed
starting from 1; a ‘*’ selects all words. If the first number of a range
is omitted (as with $argv[-2]), it defaults to 1. If the last number of
a range is omitted (as with $argv[1-]), it defaults to $#var (the word
count). It is not an error for a range to be empty if the second argument
is omitted (or within range). |
$#name
${#name} |
These
give the number of words in the variable.
$0 This substitutes
the name of the file from which command input is being read except for
setuid shell scripts. An error occurs if the name is not known. |
$n
${n} |
Equivalent
to $argv[n]. |
| $* |
Equivalent
to $argv[*]. |
| Modifiers |
Description |
| # |
The
entire command line typed so far. |
| 0 |
The
first input word (command). |
| n |
The
n’th argument. |
| ^ |
The
first argument, that is, 1. |
| $ |
The
last argument. |
| % |
The
word matched by (the most recent) ?s search. |
| x-y |
A
range of words; -y abbreviates 0-y. |
| ? |
All
the arguments, or a null value if there is just one word in the event. |
| x* |
Abbreviates
x-$. |
| x- |
Like
x* but omitting word $. |
| Non-modifiable |
Description |
$?var
${?var} |
Substitutes
the string 1 if var is set or 0 if it is not set. |
| $?0 |
Substitutes
1 if the current input filename is known or 0 if it is not. |
| $$ |
Substitute
the process number of the (parent) shell. |
| $< |
Substitutes
a line from the standard input, with no further interpretation thereafter.
It can be used to read from the keyboard in a C shell script. |
|
|
|
|
 |

|
 |
|
Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
| |
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
| |
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
| |
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
| |
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!
|
|
Service Details
|
|
 |
|