Purpose: to calculate the amount of disk used in megabytes amtdir=`df -k | tail +2 | cut -c 29-36,51,53-70 | tr -d " "` for element in $amtdir do amount=`echo $element | cut -f 1 -d % ` directory=`echo $element | cut -f 2 -d % ` amount=`expr $amount / 1024` echo " The $directory has $amount megabytes used" done ~ Purpose: to calculate the amount of disk free in megabytes amtdir=`df -k | tail +2 | cut -c 38-44,51,53-70 | tr -d " "` for element in $amtdir do amount=`echo $element | cut -f 1 -d % ` directory=`echo $element | cut -f 2 -d % ` amount=`expr $amount / 1024` echo " The $directory has $amount megabytes free" done Purpose: Get the first and last names for a file and convert them names=`cut -c 1-32 /export/home/share/cis274/students.dat | cut -f 1,2 -d " " | tr -d " " ` for element in $names do last=`echo $element | cut -f 1 -d , | tr '[:upper:]' '[:lower:]' ` first=`echo $element | cut -f 2 -d , | tr '[:upper:]' '[:lower:]' ` FLlast=`echo $last | cut -c 1 | tr '[:lower:]' '[:upper:]'` FLfirst=`echo $first | cut -c 1 | tr '[:lower:]' '[:upper:]'` Rlast=`echo $last | cut -c 2-20 ` Rfirst=`echo $first | cut -c 2-20 ` echo "$FLfirst$Rfirst $FLlast$Rlast is a student in CIS246" done ~ # shell: ksh # Script Name: df.sh # Author: Abdyl A. Hajrulla # Date:Thu Nov 1 15:36:02 EST 2001 # Operating Ayatem: Sun Solaris 2.6 # Purpose:test value=`grep / dfree | cut -c 37-45` value2=`grep / dfree | cut -c 57-67` count=0 for i in $value # Both can't be $value one must be $value2 do count=`expr $count + 1` count2=0 for x in $value2 # Both can't be $value one must be $value2 do count2=`expr $count2 + 1` i=`expr $i / 1024` if test $count2 -eq $count # change count the $count then echo "The $x has $i megabytes free" #try the echo statement h ere fi done