Pre- Programming Shell Homework

Read chapter 2 in your Beginning Linx Programming textbook. Look at the shell syntax variables section (page 27 +). Create the shell script: playing with variables script on page 28. Make these changes:

Change the script to print the $0 parameter. You will see it is the path and name of the program itself. You don't have to pass the program anything to get this.

Change the script to also take in one parameter (which will be accessed as $1). Repeat the 4 echo myvar commands with the $1 parameter. Try pwd as the parameter and 'pwd'.

Change the script to change $myvar to the value of your first parameter ($1) and then echo your myvar to the screen.

Change the script to echo $HOME and to echo your path $PATH.

Upload the shell script you created.

----------------

A note on the bin directory you created. If you created a bin directory inside your home directory, it might not be included in your executable search path. To change that, edit (vi) your .bashrc file. Then, add this if statement at the end. It will add your bin directory to the executable search path.

if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi