Unit 3 HW Assignment
Chp. 7: 1,3,4,8
1. What does the shell ordinarily do while a command is executing? What should you do if you do not want to wait for a command to finish before running another command?
a. The shell starts a new process
b. use the pipe command to run two command ssimultaniusoly.
2. What is a PID number? Why are these numbers useful when you run processes in the background? Which utility displays the PID numbers of the commands you are running?
c. process identification (PID) number—a larger number assigned by the operating sys- tem.
d. Each of these numbers identifies the command running in the background. The shell then displays another prompt, and you can enter another command. You can use the PID number to kill a job running in the background.
3. Assume that the following files are in the working directory:
$ ls
intro notesb ref2 section1 section3 section4b
notesa ref1 ref3 section2 section4a sentrev
Give commands for each of the following, using wildcards to express filenames with as few characters as possible.
a. List all files that begin with section.
* Ls section*
b. List the section1, section2, and section3 files only.
* Ls section[1-3]
c. List the intro file only.
* ls i*
d. List the section1, section3, ref1, and ref3 files.
* Ls *[13]
8. Give an example of a command that uses grep
a. With both input and output redirected.
$ grep \$Id < *.c > id_list
b. With only input redirected.
$ grep -i suzi < addresses
c. With only output redirected.
$ grep -il memo *.txt > memoranda_files
d. Within a pipe.
$ file /usr/bin/* | grep "Again shell script" | sort -r
In which of the preceding is grep used as a filter?
Example d uses grep as a filter.
Chapter9
1. What are two ways you can execute a shell script when you do not have
execute access permission to the file containing the script? Can you
execute a shell...