2-1.-
$ cat time
banner `date | cut -c12-19`
$
$ chmod u+x time
2-2.-
$ cat mydate
banner `date | cut -c1-10`
$
2-3.-
$ cat tofriends
echo Type in the name of the file containing the note.
read note
mail janice marylou bryan < $note
$
Or, if you used parameters for the logins
(instead of the logins themselves)
your program may have looked like this:
$ cat tofriends
echo Type in the name of the file containing the note.
read note
mail $* < $note
$
2-4.-
date | cut -c1-10 > file1
2-5.-
echo Dear colleague >> file1
2-6.-
$ cat send.memo
date | cut -c1-10 > memo1
echo Dear colleague >> memo1
cat memo >> memo1
echo A memo from M. L. Kelly >> memo1
mail janice marylou bryan < memo1
$
2-7.-
$ cat mv.file
echo type in the directory path
read path
echo type in filenames, end with CTRL-d
while
read file
do
mv $file $path/$file
done
echo all done
$
2-8.-
$ cat mv.file
echo Please type in directory path
read path
for file in $*
do
mv $file $path/$file
done
$
The command line for moving
all files in the current directory is:
$ mv.file *
2-9.-
See the hint provided with exercise 2-9.
$ cat search
for file
in $*
do
if grep $word $file >/dev/null
then echo $word is in $file
else echo $word is NOT in $file
fi
done
$
2-10.-
Add the following lines to your .profile:
stty -tabs
stty erase
stty echoe
2-11.-
Add the following command lines to your .profile:
PS1=Hello
export PS1
2-12.-
Enter the following commands
to check the values of the
HOME, TERM, and PATH variables
in your home environment:
-
$ echo $HOME
-
$ echo $TERM
-
$ echo $PATH