LJ Archive

Listing 1. List Directory Contents Script

#!/bin/sh
# Lists the contents of a directory
dialog --title "Dialog input box" \
   --inputbox "Input directory:" 8 40 `pwd`\
   2>/tmp/dialog.ans
if [ $? = 1 ]; then
   clear
   exit 0
fi
ANS=`cat /tmp/dialog.ans`
ls -al $ANS > /tmp/dialog.ans
dialog --no-shadow \
   --title "listing of"$ANS \
   --textbox /tmp/dialog.ans 25 78
clear
rm -f /tmp/dialog.ans # don't litter !
exit 0
LJ Archive