Test your Shell Scripting Skills: – Program 3

scmuser created the topic: Test your Shell Scripting Skills: – Program 3

Write a script that lists files by modification time when called with lm and by access time when called with la. By default, the script should show the listing of all files in the current directory.

renjith replied the topic: Re: Test your Shell Scripting Skills: – Program 3

#!/bin/ksh
if [ $# -gt 1 ]
then echo ” Usage list.sh [ml|la] { expected arguments lm or la or null } “;
fi

case $* in
lm) ls -lrt ;;
la) ls -lru ;;
“”) ls ;;
*) echo “Invalid argument ”
esac

Tagged :
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x