previous up next print clean
Next: Advanced seismic processing pipeline Up: EXAMPLES Previous: SEP data cube viewer

Directory lister

Now a more complicated script. This script can be used to navigate a directory hierarchy. It puts all the files in the current directory into a list. When you choose a file it does one of two things. If the file is a directory, it goes to that directory and reruns the program to produce a new listing panel. If the file is a regular file it performs the Unix command specified in the dialog. Note that the rules governing newlines within an action allow us to embed a complete multiline shell script within an action. The resulting panel is shown in figure [*].

button={ label=DONE action=QUIT }

hbox={ message={ value="Directory:" } message={ value=`pwd` } }

dialog={ name=command label="Command for files" value="xterm -e vi" }

list={ name=name label="NAMES" action=" if test -d $val then cd $val xtpanel -file examples/script/lister & else $command $val & fi" itemlist={ list=`echo -n .* * ` separator=" " } }

 
lister
Figure 7
A panel to traverse a Unix filesystem.
lister
view


previous up next print clean
Next: Advanced seismic processing pipeline Up: EXAMPLES Previous: SEP data cube viewer
Stanford Exploration Project
11/17/1997