Start a bash shell in a console or terminal window and enter the following commands:
echo $MYVAR1 $MYVAR2$
echo $MYVAR1 $MYVAR2
Was the behavior of the two echo commands identical?
If so, why? If not, why not?
What happened immediately after the bash command?
Which variable is an environment variable?
Continuing the previous exercise, press the up arrow until you see the last echo command. Press the up arrow again.
What do you see?
Why wasn’t it the exit command?
Press the up arrow again so that the
exportcommand is displayed. Add a space and
MYVAR2so that the line now looks like this:
export MYVAR1 MYVAR2
What happens when you enter this command?
Still continuing the previous exercise, enter the command !echo. Does anything change as a result of the revised export command?
The file command is used to examine a file’s contents and displays the file type. Explain the result of using file as follows:
cd / ; file `ls | head -10`
Execute this command on your system:
cut -d: -f1 /etc/passwd | fmt -w 20 | head -1
What was displayed?
How many lines of output did you see? Why?
What was the width of the output? Why?
Execute the following sed substitution command and explain why it might be used on /etc/passwd:
sed 's/:[^:]*:/:---:/' /etc/passwd | less
Execute this command:
cd /sbin ; ls -li e2fsck fsck.ext2
What is the significance of the first field of the output?
Why is it identical for both listings?
Why are the file sizes ...