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



write a scwipt that a) takes exactly one argument, a directory name. b) if the number of argument ..

Answer / syalshidi



practcal withe vmware
unix

Is This Answer Correct ?    3 Yes 3 No

write a scwipt that a) takes exactly one argument, a directory name. b) if the number of argument ..

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

Post New Answer

More Shell Script Interview Questions

What is batch file programming?

0 Answers  


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 ?

4 Answers  


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?

2 Answers   Cap Gemini,


is this growing field and what is average package in this?

0 Answers  


1.Write a script, which converts a number from binary to hexadecimal format or vice versa.

1 Answers   ADP,






How important is shell scripting?

0 Answers  


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"

6 Answers  


What shell is bin sh?

0 Answers  


How to enable the shell to know what program should be run to interpret the script?

3 Answers  


how to read systems current date and time

4 Answers  


What are the 3 standard streams in linux?

0 Answers  


How can I set the default rwx permission to all users on every file which is created in the current shell?

0 Answers  


Categories