11. More on Parameters

In this chapter, you’ll learn more about variables and parameters. Technically, parameters include the arguments passed to a program (the positional parameters), the special shell variables such as $# and $?, and ordinary variables, also known as keyword parameters.

Positional parameters cannot be assigned values directly but they can be reassigned values with the set command. As you know, variables are assigned values simply by writing


The format is a bit more general than that shown, actually, because you can assign several variables at once using the format

variable=value variable=value ...

The following example illustrates:

$ x=100 y=200 z=50 $ echo $x $y $z 100 200 50 $

Parameter Substitution

In the ...

Get Shell Programming in Unix, Linux and OS X, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.