The purpose of this assignment is to write shell scripts to run in the Unix environment. The problem is to build a simple file manager that will allow a user to list files in a directory, to select files, and to perform actions on them. The actions are based on the file type and file permissions.
The assignment could be done as a program run in a command line environment. To make it more interesting, you should use some simple X Window applications that are designed to work in shell scripts, to build a shell script that is also a GUI application.
ListSelect
is a Java program that reads lines from standard
input and displays them in a list. The input list is terminated by
end-of-file. If an item in the list is selected, it's string value is
printed to standard output.
ListSelect
has two optional arguments
ListSelect
shows
a "quit" button and will not exit. Each selection will be
written to standard output. If this option is not set,
then ListSelect
will terminate after one selection
has been made
ListSelect
will
show the string as a title
echo 'item1
item2' | java ListSelect -persistent
ButtonSelect
is a Java application that shows a message and
a list of buttons. Pressing one of the buttons will write the button's
label to standard output. The list of buttons is read from standard
input, one label per line, terminated by end-of-file.
echo 'btn1 btn2' | java ButtonSelect Press any button
ButtonSelect
will display its command-line arguments
as message text above the buttons.
Warning
shows its command line arguments in a warning
dialog
java Warning File not found
OnOff
displays two buttons "On" and "Off".
If "On" is selected it writes "1" to standard output.
If "Off" is selected it writes "0" to standard output.
Ask
asks its commmand line arguments in a question
dialog box. If "yes" is selected, it writes "1" to standard output
and exits with an exit code of "0". If "no" is selected, it writes
"0" to standard output and exits with an exit code of "1"
Cat
reads lines from standard input and displays them in a dialog.
If ^L is entered on a line by itself, it clears the dialog.
Otherwise, each line entered is added to the dialog box
The Java class files are available as a jar
file from here.
Your program should consist of one or more shell scripts using the Bourne shell, common Unix utilities and any of the above Java progams. The main script can be called with zero or one argument. If called with one argument, then it should list the files in that directory. If called with zero arguments, it should list the files in the current directory.
The listing should be of all files (and directories) including "." and "..", but not any other hidden files. It should allow selection of any file in the listing and take an appropriate action based on the file type.
emacs
should be run, or a non-graphical
editor such as vi
should be run in a new
xterm
window
xterm
window
xterm
window
xterm
normally displays a terminal window.
To run a command within a terminal window, use the "-e" option
xterm -e vi
runs the vi
editor in an xterm
Some attempted actions will result in errors, such as attempting to change to a directory for which you do not have permission. Errors should be reported using an error dialog.
The assignment is due on 5pm, Friday 11 April, the end of week 6.