O'Reilly logo

Shell Programming in Unix, Linux and OS X, Fourth Edition by Patrick Wood, Stephen G. Kochan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

variable=value

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required