Write a script to display the last modified file.

clear

while true;do

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

read path1

[[ -d $path1 ]] && break

echo Invalid name

done

 

cd $path1

ls * -dlptr | tail -n1

 

OUTPUT::

 

Enter the directory name ::a2

-rw-r–r– 2 abc None 0 Oct  7 21:35 a2

 

Share

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.