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?
What is the default shell of solaris?
In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?
Is powershell a language?
Explain about sourcing commands?
Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.
Write down the syntax for all the loops in shell scripting.
What is the difference between a 'thread' and a 'process'?
What does it mean to debug a script?
Hi, i want to zip the files that generates automatically every few minutes (files generated are in .arc extension)....any body write a script for this... thanks in advance
how to delete all the files with extension .dat rom a directory tree from root to third level in a single unix command?
Determine the output of the following command: [ -z “” ] && echo 0 || echo 1