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 are the different methods available to run a shell script?
What is the best scripting language?
What are the advantages of bash over all other shells?
What is the use of break command?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?
what is the difference between writing code in shell and editor?
How does path variable work?
What language is used in terminal?
What is echo in shell?
How can I Debug a shell scripts and Perl scripting?? or How do you debug a shell scripting and perl scripting ( at the compile time error or run time error) in Unix environment ?
How to find duplicate record in file using shell script?
0 Answers IBM, Saama Tech, Wipro,
What is a shell script? Can you name some of its advantages?