O'Reilly logo

A Practical Guide to Red Hat® Linux® 8 by Mark G. Sobell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required