Shell Script Loop

This piece of code sets files equal to 3 different files, then goes through a for / next loop to determine if they exist


#!/bin/ksh
files="/etc/passwd /etc/group /etc/hosts"
for f in $files; do
   if [ ! -f $f ]
      then
         echo "$f file missing!"
   fi
done
#!/bin/ksh
for car in $(cat car.txt)
do
   print "Current Car : $car"
done

#!/bin/ksh
for f in $(ls /tmp/*)
do
   print "Full file path  in /tmp dir : $f"
done

Leave a Reply

Your email address will not be published. Required fields are marked *