negahdar
asked on
shell
The following shell script adds entries to a file named journal-file in your home directory. It can help you keep track of phone conversations and meetings.
$ cat journal
# journal: add journalentries to the file
# $HOME/journal-file
file=”$name” n >> $file
date >> $file
echo “Enter name of person or group: \c”
read name
echo “$name” >> $file
echo >> $file
cat >> $file
echo”--------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----“>> $file
echo >> $file
Why does it use the read built-in the first time it accepts input from the terminal and the cat
utility the second time?
$ cat journal
# journal: add journalentries to the file
# $HOME/journal-file
file=”$name” n >> $file
date >> $file
echo “Enter name of person or group: \c”
read name
echo “$name” >> $file
echo >> $file
cat >> $file
echo”---------------------
echo >> $file
Why does it use the read built-in the first time it accepts input from the terminal and the cat
utility the second time?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
read name
takes the input whenever you press "enter"
cat >> $file
wait till Cntl+D
Vinit
takes the input whenever you press "enter"
cat >> $file
wait till Cntl+D
Vinit
cat reads until end of file