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
Write the syntax for "if" conditionals in linux?
How does path variable work?
What is echo in shell?
What are the advantages of using shell scripts?
Write down the syntax for all the loops in shell scripting.
Set up a Sev 2 alert when the Primary WA service fails. A windows batch script needs to be created that will monitor the WA service on the Primary and when the service stops/fails a Sev 2 TT is generated for a particular team ?
Is cmd a shell?
What is $1 in shell scripting?
What is batch file programming?
Print the 10th line without using tail and head command.
Explore about environment variables?
What are the two files of crontab command?
What is the use of "$?" Sign in shell script?
write a shell script to check the failed jobs?
How can I set the default rwx permission to all users on every file which is created in the current shell?