# shell script to check whether file exist in a directory
# if exists then show last modification time
#!/bin/bash
echo "Enter file name "
read mfile
if [ ! -f $mfile ] ; then
echo "file does not exist"
exit 1
else
echo "file exists"
echo "Last modification time : `ls -l $mfile | cut -d " " -f 9` "
fi
# if exists then show last modification time
#!/bin/bash
echo "Enter file name "
read mfile
if [ ! -f $mfile ] ; then
echo "file does not exist"
exit 1
else
echo "file exists"
echo "Last modification time : `ls -l $mfile | cut -d " " -f 9` "
fi
No comments:
Post a Comment