#!/bin/sh #see documentation on page 379 #run this from the scriptsource directory and it will work #general usage: #for in [ list ] #do # commands #done #this says that for i (a list) do the following #notice how I have turned the ls command into a list $(ls) #this removes all the text files in the parent/scripts directory #for this to work there must be at least 1 .txt file in the directory for i in $(ls ../scripts/*.txt) do echo Removing $i rm $i sleep .5 done #this copies all shell scripts to a .txt file so that the #MIME type can be handled by the Web Server for i in $(ls *.sh) do echo Copying $i cp $i ../scripts/${i}.txt sleep .5 done #This ensures that the permissions are set correctly #so that the web server can send them to you for i in $(ls ../scripts/*.txt) do ls -l $i chmod 644 ../scripts/$i sleep .5 echo now the permission for $i is set to ls -l $i done #CSC128: Shell Script Examples - for loop handling file operations