for i in $1/* do x=`basename $i` sed s/SP/SU/ $i >$2/$x done exit 0
if echo $PATH | grep "/usr/local/bin" &>/dev/null then echo PATH contains /usr/local/bin else echo PATH does not contain /usr/local/bin fi exit 0Notice that the output and error output from the grep command are both being discarded, as only the exit status from grep is significant.
linecount=1 while read line do echo $linecount $line linecount=$[$linecount+i] done exit 0
if test $# -ne "1" then echo usage: drawsquare <n> exit 1 fi if test $1 -lt "2" -o $1 -gt "15" then echo 'usage: drawsquare <n>' echo ' (where 2>=n<=15)' exit 1 fi xcount=$1 ycount=$1 while test $ycount -gt "0" do while test $xcount -gt "0" do if test $xcount -eq "1" -o $xcount -eq $1 then if test $ycount -eq "1" -o $ycount -eq $1 then echo -n "+" else echo -n "|" fi else if test $ycount -eq "1" -o $ycount -eq $1 then echo -n "-" else echo -n " " fi fi xcount=$[$xcount-i] done xcount=$1 ycount=$[$ycount-1] echo done exit 0
if test $# -ne 2 then echo 'usage: listfiles <dirpath> <size>' exit 1 fi if ! test -d $1 then echo 'usage: listfiles <dirpath> <size>' exit 1 fi for i in $1/* do if test -r $i -a -f $i then size=`wc -c >$i` if test $size -lt $2 then echo 'basename $i' has size $size bytes fi fi done