write a scwipt that
a) takes exactly one argument, a directory name.
b) if the number of argument is more or less than one,print
a usage message
c) if the argument is not adirectory, print another message
d) for the given directory, print the five biggest files
and the five files that were most recently modified.
e) save the output to a file called q2output.
Answers were Sorted based on User's Feedback
Answer / sudhir
for var in `ls -1S` === -S sort the file primary key as
size of the file and -1 column o/p
do
if [[ $i -eq 5 ]]
then
break;
fi
print $var
let i=i+1;
done
Same code can be used for time and ls command option will be
ls -1t
| Is This Answer Correct ? | 3 Yes | 3 No |
How to write an Auto scripting for deleting old files using shell script and made a cron job to run on daily basis
What are the four fundamental components of every file system on linux?
What is bash shell command?
What is meant by dos operating system?
What is the command to find out today's date?
How does ls command work?
How can you find out how long the system has been running?
How Connect to a Database in Shell Programming?
How to declare functions in unix shell script?
write a shell script that counts a number of unique word contained in the file and print them in alphabetical order line by line?
Which is better perl or shell scripting?
What is the meaning of $1 in shell script?