Tuesday, September 05, 2006

bash basics

To recurse through directories you can do:

for i in $( ls );
do
echo $i;
done

To see if a file exists:

if [ -f file_name ]
then
echo "File exists"
elif [ -d filename ]
then
echo "File is a directory"
else
echo "File does not exists"
fi