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 |
What is the use of script interpreter in shell scripting?
c program to check whether all the directories in the path exists has read and write permission
How to print pid of the current shell?
What are the different types of variables used in shell script?
how did u debugging in unix/ linux platform ??( project Related)
What are the advantages of shell scripting?
What is $1 in shell scripting?
How will you list only the empty lines in a file (using grep)?
whta is the use of "exec" command?
Why is it called a shell?
How can I set the default rwx permission to all users on every file which is created in the current shell?
What is awk in shell script?