Question: Linux 3. What is the purpose of the PATH variable? a. Set the PATH variable so that it causes the shell to search the following
Linux
3. What is the purpose of the PATH variable?
a. Set the PATH variable so that it causes the shell to search the following directories in order:
-- /usr/local/bin
-- /usr/bin
-- /bin
-- /usr/kerberos/bin
-- The bin directory in your home directory
-- The working directory
b. If there is a file named doit in /usr/bin and another file with the same name in your ~/bin, which one will be executed? (Assume that you have execute permission for both files.)
c. If your PATH variable is not set to search the working directory, how can you execute a program located there?
d. Which command can you use to add the directory /usr/games to the end of the list of directories in PATH?
5. The following shell script adds entries to a file named journal-file in your home directory. This script helps you keep track of phone conversations and meetings. (The first line is the command to show you what is in the script.)
$ cat journal
# journal: add journal entries to the file
# $HOME/journal-file
file=$HOME/journal-file
date >> $file
echo -n "Enter name of person or group:
" read name
echo "$name" >> $file
echo >> $file
cat >> $file
echo "----------------------------------------------------" >> $file
echo >> $file
a. What do you have to do to the script to be able to execute it?
b. Why does the script use the read builtin (page 953) the first time it accepts input from the terminal and the cat utility the second time?
9. Write a sequence of commands or a script that demonstrates that variable expansion occurs before pathname expansion.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
