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.
Answer Posted / 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 |
Post New Answer View All Answers
How are shells born?
What is a boot block?
What is the conditional statement in shell scripting?
State the advantages of shell scripting?
What is a command line shell?
How to write a function?
What language is used in terminal?
How will you connect to a database server from linux?
How do I edit a .sh file?
What is option in shell script?
What's the difference between scripting and coding?
What is awk in shell script?
What language is bash written in?
Is shell script a programming language?
c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l