Thursday 21 May 2015

Write a shell script that displays all the links to a file specified as the first argument to the script. The second argument, which is optional, can be used to specify in which the search is to begin. If this second argument is not present, the search is to begin in current working directory. In either case, the starting directory as well as all its subdirectories at all levels must be searched. The script need not include any error checking.VTU UNIX LAB6B

echo "Enter a dir name"
read dir
var=`ls $dir`
for x in $var
do
    len=`expr $x : '.*'`
    if [ $len -ge 10 ]cd
    then
        echo "$x"
     fi
done

No comments:

Post a Comment