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.
$ 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 the first time it accepts input from
the terminal and the cat utility the second time?
a. You need read and execute permission to the file that contains the script
to execute the script by giving its filename as a command. Use the com-
mand chmod 755 journal or chmod u=rwx,go=rx journal to give yourself
read, write, and execute access and to give everyone else read and execute
access to the file.
b. The read builtin accepts text until you press RETURN, which is appropriate
for accepting input when the user enters a name. The cat utility accepts
input until you press CONTROL-D at the beginning of a line, which is appro-
priate for accepting several lines of input.
You might also like to view...
Case-Based Critical Thinking QuestionsCase 8-3Cali Polaris Jet Skis has a Web site for amateur jet skiers. The Web site displays on a computer monitor and a mobile device. However, on the mobile device the fullscreen view is small and difficult to read. Cali would like to design a style sheet appropriate for the smaller screens found on most mobile devices. You have been hired for this task. To begin, you will use a(n) ____ to develop and test Web site designs and create custom mobile Web apps without owning the hardware device.
A. SDK B. Software Development Kit C. emulator D. both a. and b.
The ____ fill allows you to remove objects from a photograph and replace them with similar versions of the surrounding pixels.
a. Photograph Removal b. Pixel-Removal c. Photo-Editing d. Content-Aware
Free anti-malware programs are not reliable and not recommended.
Answer the following statement true (T) or false (F)
A data analysis tool that provides results based on changing two variables.
What will be an ideal response?