Changes

Jump to navigation Jump to search
13 bytes added ,  08:56, 25 September 2009
Line 9: Line 9:  
==Make function readonly==
 
==Make function readonly==
 
* You need to use the -f option to make corresponding function readonly and syntax is:
 
* You need to use the -f option to make corresponding function readonly and syntax is:
<source>readonly -f functionName</source>
+
<source lang="bash">readonly -f functionName</source>
 
* For example, write a function called hello() at a shell prompt, enter:
 
* For example, write a function called hello() at a shell prompt, enter:
<source lang="basb">function hello() { echo "Hello world"; }
+
<source lang="bash">function hello() { echo "Hello world"; }
 
# invoke it  
 
# invoke it  
 
hello</source>
 
hello</source>
Line 22: Line 22:  
Sample outputs:
 
Sample outputs:
 
<pre>bash: hello: readonly function</pre>
 
<pre>bash: hello: readonly function</pre>
 +
 
==Display all readonly variables==
 
==Display all readonly variables==
 
If no arguments are given, or if -p is given to the readonly buitin, a list of all readonly names is printed on screen:
 
If no arguments are given, or if -p is given to the readonly buitin, a list of all readonly names is printed on screen:

Navigation menu