Tuesday 21 April 2015

Write a shell script that lists files by modification time when called with lm and by access time when called with la.

This shell program will lists files by modification and access time, by default the script should show the listing of all files in the current directory


echo "*****************************"
if [ "$1" == "la" ];then
echo "Access time"
ls -ul | tr -s " " | cut -d " " -f 6,7,8,9
elif [ "$1" == "lm" ];then
echo "Modification time"
ls -ml | tr -s " " | cut -d " " -f 6,7,8,9
else
echo "***list of all files in current directory***"
ls -l | tr -s " " | cut -d " " -f 9
fi


No comments:
Write comments

Featured post

List of Universities in Karnataka offering M.Sc Computer Science

The post-graduate programme in Computer Science (M.Sc Computer Science) contains two academic years duration and having a four semesters....

Popular Posts

Copyright @ 2011-2022