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 mac default shell?

0 Answers  


When should shell programming/scripting not be used?

0 Answers  


In shell scripting if text is surrounded by single quotes what does it denotes?

3 Answers  


Hi, I want to practise Unix korn shell scripting which i learnt 2 yr bfr. plz suggest software i can use to practise.

1 Answers  


How to use arguments in a script?

0 Answers  






What are the advantages of using shell scripts?

0 Answers  


Where are cowrie shells found?

0 Answers  


What is the command for " how many shell is running in your system or how many shell supported by your system " ?.

3 Answers  


write a program to display all the files from the current directory which are created in particular month

6 Answers  


how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com

0 Answers  


Write a shell program to test whether a given number is even or odd?

8 Answers  


How to print all array elements and their respective indexes?

0 Answers  


Categories