May 15, 2011

If else bash in OSX

#!/bin/ksh
# If Else reference
FILES=./*.txt
for f in $FILES
do
echo "Processing $f file..."
# take action on each file. $f store current file name
let i=1
tail -r $f | while read line;
do
echo $line
let j=i+1
i=j
if [[ $j != 10 ]]
then echo "value of j $j"
fi

done

done

No comments: