Wednesday 28 March 2018

Shell script to display the last modification time of a file

#shell script to display the  last modification time of a file
echo  "Enter name of the file:"
read n
if  [ -e $n ]
then
        echo 'Last modification time is' `ls -l $n | cut -d" " -f 6,7,8`
else
        echo "file does not exist"
fi


OUTPUT
csc@csc-SVE1513CYNB ~ $ sh mtime.sh
Enter name of the file:
oddeven02.sh
Last modification time is Mar 28 15:21

No comments:

Post a Comment