Sunday 10 August 2014

Write a shell script that accepts as filename as argument and display its creation time if file exist and if it does not send output error message

.
if [ $# -eq 0 ]
then
echo "No argument"
exit
fi
if [ -f $1 ]
then
time=`ls -l $1|cut -c 33-59`
echo "File $1 has created on $time"
else
echo "File $1 does not exist"
fi

0 comments:

Post a Comment

 
- |