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 batch file programming?
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 ?
Hi All, Is it possible to create one file name only space or space in file name in UNIX and we can able to run that on Unix?
is this growing field and what is average package in this?
1.Write a script, which converts a number from binary to hexadecimal format or vice versa.
How important is shell scripting?
Create a bash shell script that removes all files whose names end with a "~" from your home directory and subdirectories. Name this script "cleanup.sh"
What shell is bin sh?
How to enable the shell to know what program should be run to interpret the script?
how to read systems current date and time
What are the 3 standard streams in linux?
How can I set the default rwx permission to all users on every file which is created in the current shell?