Shell Spricting: Environment Variables. A shell variable is a memory storage area that can be used to hold a value, which can then be used by any built-in shell command within a single shell. An environment variable is a shell variable that has been exported or published to the environment by a shell command so that shells and shell scripts executed below the parent shell also have access to the variable.
One built-in shell command can set a shell variable value, while another can pick it up. In the following doecho script example, $PLACE is set in the first line and picked up in the second line by the built-in echo command.
Create this script and save it as doecho. Change the mode using chmod a+x doecho:
# doecho sample variable
echo "doecho says Hello " $PLACE
Run the program as shown below.
In all of the following examples, I use the convention of ./command to execute a shell script in the current directory. You don't need to do this if your $PATH variable contains the . as one of the searched directories. The ./command method works for scripts in your current directory, even if the current directory isn't included on your path.
doecho says Hello Hollywood
Previous Part : Part 2 :- http://www.youtube.com/watch?v=00BIYbcg_pQ&feature=channel&list=UL
Part 1: http://www.youtube.com/watch?v=HgBHssJ5fTw&feature=g-upl&context=G27c2154AUAAAAAAADAA
Tags: Shell Spricting: Environment Variables, 03, Environment, Variables