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 are the different methods available to run a shell script?

2 Answers  


What is the best scripting language?

0 Answers  


What are the advantages of bash over all other shells?

1 Answers  


What is the use of break command?

0 Answers  


I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

0 Answers  






what is the difference between writing code in shell and editor?

1 Answers  


How does path variable work?

0 Answers  


What language is used in terminal?

0 Answers  


What is echo in shell?

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  


How to find duplicate record in file using shell script?

0 Answers   IBM, Saama Tech, Wipro,


What is a shell script? Can you name some of its advantages?

0 Answers  


Categories