4.3 VariablesThis subsection describes the following:
4.3.1 Variable Substitution
No spaces should be used in the expressions below. The colon
(
In the Korn shell:
4.3.1.1 Examples
$ 4.3.1.2 Korn Shell Example
tail='${PWD##*/}' Take the current directory name and remove the longest character string ending with /. This removes the leading pathname and leaves the tail. 4.3.2 Built-in Shell VariablesBuilt-in variables are automatically set by the shell and are typically used inside shell scripts. Built-in variables can make use of the variable substitution patterns shown above. Note that the $ is not actually part of the variable name, although the variable is always referenced this way.
The Korn shell automatically sets these additional variables: 4.3.3 Other Shell VariablesThe variables below are not automatically set by the shell. They are typically used in your .profile file, where you can define them to suit your needs. Variables can be assigned values by issuing commands of the form:
The list below includes the type of value expected when defining these variables. Those that are specific to the Korn shell are marked as (K). 4.3.4 Arrays
The Korn shell supports one-dimensional arrays of up to 1024 elements.
The first element is numbered 0.
An array
where the specified values become elements of When referencing arrays, you can use the ${ ... } syntax. This isn't needed when referencing arrays inside (( )) (the form of let that does automatic quoting). Note that [ and ] are typed literally (i.e., they don't stand for optional syntax).
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|