Exercises

1.The following shell script adds entries to a file named journal-file in your home directory. The script can help 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
  1. What do you have to do to the script in order to be able to execute it?

  2. Why does it use the read builtin the first time it accepts input from the terminal and the cat utility the second time?

2.What are two ways you can execute a shell script when you do not have execute ...

Get A Practical Guide to Red Hat® Linux® 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.