CS476/576
Assignment #1
Due Midnight,
Wednesday
Sept 24, 2003
Write a shell script (in any shell you
like)
with the following descriptions:
NAME
eman-
enhanced man
SYNOPSIS
eman
[-v] cmd
DESCRIPTION
The eman command
is an enhanced version of the classical UNIX man command. For each unix
cmd
it creates two files:
- cmd.pdf a formatted fancy pdf
file.
- cmd.txt
a non formatted text file.
The program has only one
option [-v] to display
the .pdf file (if possible) or the .txt file*.
The program stores all the
produced .pdf and .txt files under $HOME/eman_files.
Before processing any
cmd, the program first checks to see if the corresponding .pdf and the
.txt files already stored under $HOME/eman_files.
Examples:
Assume that: $HOME
is /home/cs476
$ rm
-r /home/cs476/eman_files
$ eman ls
This creates
two files under /home/cs476/eman_files:
ls.txt and
ls.pdf.
$
eman -v ls
If an X
server is running on the user machine and the DISPLAY variable is set
correctly the program uses the ghostview command to
display ls.pdf otherwise it uses the more
command.
$ eman -v xterm
This creates two
files under /home/cs476/eman_files:
xterm.txt
and xterm.pdf and display either xterm.pdf or xterm.txt as explained in
the above example.
See script
of using this command
* For CS476 students: You
may always display the .txt file.