Write a script to display the name of those files (in the given directory) which are having multiple links.

clear

while true;do

echo -e “Enter the directory name ::\c”

read path1

[[ -d $path1 ]] && break

echo Invalid name

done

 

a=1

if [ -d $path1 ]

then

cd $path1

for i in *

do

for j in *

do

if test “$i” != “$j”; then

if test “$i” -ef “$j”; then

echo “$i” >> temp

a=0

fi

fi

done

done

if [ $a -eq 0 ]

then

cat temp | uniq

rm temp

str=cd -

echo $str”/”$path1

else

echo “No link file found”

fi

else

echo Check your path

fi

 

OUTPUT::

 

Enter the directory name ::a2

a2

a4

/home/abc/a2

 

OR

echo “Display files with multiple links”

echo find . ! -links 1

 

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.