
Linux Command Line and Shell Scripting Techniques
By :

We mentioned that it is possible to use global variables to pass values to the functions inside a script and to get results back. This is the worst possible way to do it. If we need to pass some value to a function, using arguments is the way it should be done. The problem that we still have is how to get the results back when the function finishes. We are going to solve that in this recipe.
If nothing else, bash
is logical and consistent in the syntax it uses. The reason we are mentioning this is that when functions return a value, they use the exact same mechanism that scripts use when returning a variable—the return
command. Using this command, it is possible for a function to return a value when called, but the value can be in the range of numbers between 0
and 255
. There is also a possibility to set a global variable just to return a function value—for example, if we need to return a string—but try...
Change the font size
Change margin width
Change background colour