topical media & game development

talk show tell print

basic-shell-app-a-exercise-03-05.sh / sh



  # This example extends the myls script.
  
  echo -n "Please enter the directory to list: "
  read DIRECTORY
  
  # Change to this directory
  # so the file listing is all relative file names.
  
  cd DIRECTORY      
  
  # List the files.
  echo "Listing DIRECTORY"
  
  for filename in *
  do
      if [ -d filename ] 
      then
          echo "filename/"
      elif [ -x filename ]
      then
          echo "filename*"
      else
          echo filename
      fi
  done
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.