typeset特殊内置命令为指定的参数赋值并指定属性。 使用typeset特殊内置命令来描述 Korn shell 程序支持的属性。 导出的参数将值和属性传递到环境。 命名参数的值通过如下指定: Name=Value [ Name=Value ] ... 如果为Name参数设置了-i整数属性,那么将对Value参数进行算术求值。 Shell 支持一维的数组工具。 数组参数...
Korn shell parameters are discussed below. A parameter is defined as the following: Identifier of any of the characters asterisk (*), at sign (@), pound sign (#), question mark (?), hyphen (-), dollar sign ($), and exclamation point (!). These are calledspecial parameters. Argument ...
The following parameters are automatically set by the shell: # The number of positional parameters in decimal. - Options supplied to the shell on invocation or by the set command. ? The exit status returned by the last executed command. Its meaning depends on the command or function that defi...
Parameters of the form name=value turn on the associated attributes and also assign value to name. When typeset is invoked inside a function, a new instance of each name is created. After the function terminates, each name is restored to the value and attributes it had before the function...
Learn how you can use variables and parameters in Korn shell to store values. You will also see how the Korn shell supports data types and arrays.
Functions improve the shell’s programmability significantly, for two main reasons. First, when you invoke a function, it is already in the shell’s memory (except for automatically loaded functions; see Section 4.1.1.1, later in this chapter); therefore a function runs faster. Modern computers...
We have already seen many examples of thepositional parameters(variables called1,2,3, etc.) that the shell uses to store the command-line arguments to a shell script or function when it runs. We have also seen related variables like*(for the string of all arguments) and#(for the number...
UNIX Shell Programming QuickStart 2.5 The Korn Shell Constructs The Korn and Bash shells are very similar. The following constructs will work for both shells. To see all the subtle variations, see the individual chapters for these shells.
If there is at least one argument on the shell's command line, the first argument is taken as the name of a shell script to execute (the exception to this is when -s is used). Any additional arguments are assigned to the positional parameters, which usually serve as arguments to the ...
A dtksh category 4 command returns a value that can be used in a conditional expression just as in C. If the C function also returns values through reference variables (as in category 2), the dtksh command also uses variable names for the corresponding parameters. Example: ...