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 MCA UNIX LAB4B

if [ $# -eq 1 ]
then


echo "hard links to file $1 are "
var=`ls -i $1 | cut -d " " -f 1`

find . -inum $var
echo "soft link to $1 are"
find . -lname $1
else
echo "k;lk;"
fi

No comments:

Post a Comment