-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Linux Command Line and Shell Scripting Bible - Third Edition
By :
You might have noticed in the test5 example in the previous section that we used a variable called $value within the function to hold the value that it processed. When you use variables in your functions, you need to be somewhat careful about how you define and handle them. This is a common cause of problems in shell scripts. This section goes over a few techniques for handling variables both inside and outside your shell script functions.
As mentioned earlier in the “Returning a Value” section, the bash shell treats functions just like mini-scripts. This means that you can pass parameters to a function just like a regular script (see Chapter 14).
Functions can use the standard parameter environment variables to represent any parameters passed to the function on the command line. For example, the name of the function is defined in the $0 variable, and any parameters on the function command line are defined using...
Change the font size
Change margin width
Change background colour