LJ Archive

Listing 2. Mutiple Directory Script

#!/bin/sh
# Lists the contents of a directory
while [ 0 ]; do
   dialog --title "Dialog input box" --inputbox\
      "Input directory or \n press <Cancel> to exit"\
      9 40 `pwd` 2>/tmp/dialog.ans
   if [ $? = 1 ]; then
      clear
      rm -f /tmp/dialog.ans # don't litter !
      exit 0
   fi
   ANS=`cat /tmp/dialog.ans`
   ls -al $ANS > /tmp/dialog.ans 2>/dev/null
   if [ $? = 1 ]; then
      dialog --title "Error" \
        --msgbox "no such directory" 5 40
      continue
   fi
   dialog --no-shadow \
     --title "listing of "$ANS \
     -textbox /tmp/dialog.ans 25 78
done
LJ Archive