The majority of Unix utilities are character-based. Some that I have written
are X Window-based, but can still be used in pipelines.
Two are xselect
, that displays a list of choices and
sends selections to standard output, and xview
that reads
filenames of images and displays them.
This assignment is to build a "picture viewer". That is, you need to write a shell script using a mixture of character and X Window applications that will display a list of "image descriptions". When a description is selected, a corresponding image will be displayed.
The relation between image filenames and descriptions will be given in a configuration file. Various sanity checks should be performed to ensure the program you write is robust in the face of errors.
xselect
is an X Window application that reads lines of
text and displays them in a selectable list. When the user clicks on
one of the items the text of the item is sent to standard output,
newline terminated.
xview
is an X Window application (actually, a Java application)
that reads lines from standard input. When a line is read it is
interpreted as the file name of an image, and that image is diplayed.
Currently, the images must be GIF images.
boy.gif A boy on a bike girl.gif A girl on a swing children.gif Two childrenYou may assume that the configuration file is syntactically corrrect: each line will contain at least two "words" separated by white space.
The program will display the list of descriptions using
xselect
. When a description is chosen, the corresponding
image file will be displayed using xview
.
Your script should allow the user to select images one after another.
On each selection the new choice should be shown. These successive
images should be shown in the same xview
window.
xwarn
and xerror
take
strings as command line arguments and display them in suitable
dialog boxes.
give
command:
give a1 filename-of-your-shell-scriptThis will make a copy of your shell script in a file where OS tutors can access it, but no-one else.
The give
command can be run as often as you like.
Each new submission overwrites any previous one (see exception later).
No record is kept of the number of times you run the command.
Assignments submitted after the due date are stored under a different name to assignments submitted on time. Late penalties may be attached to assignments submitted late.
Each assignment should contain at least
Consistent and readable indentation must be used. Names of variables should be meaningful.