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 echo in shell?

0 Answers  


How do I run a script from command prompt?

0 Answers  


How do I run a script on mac?

0 Answers  


Which scripting language is best for automation?

0 Answers  


How does path variable work?

0 Answers  






How would you compare the strings in a shell script?

0 Answers  


What are environment variables?

2 Answers  


Why is the use of shell script?

0 Answers  


How do we create command aliases in a shell?

0 Answers  


What is the first line in every perl script called?

0 Answers  


What language is used in terminal?

0 Answers  


What is mac default shell?

0 Answers  


Categories