Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Tuesday, 13 March 2012

Write a script to implement the following commands: Tree (of DOS) which (of UNIX)


echo "Enter path Name :="
read path
name=`find  "$path"  -print0 | xargs -0`
for i in $name
do
if [ -d $i ];then
echo $i>file.txt
count=`awk 'NF{print NF-1}' FS="/" file.txt`
format="|__"
temp=`expr $count + 1`
i=`echo $i|cut -d "/" -f $temp`
for (( j=0 ; $j < $count ; j=`expr $j + 1` ))
do
format="|    "$format
done
echo "$format$i"
fi
done

No comments:

Post a Comment