Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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` &#61671;=== -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


Please Help Members By Posting Answers For Below Questions

How do I run a .sh file?

1075


Explain how you Automate your application using Shell scripting.

2363


What is the first line in every perl script called?

1100


What is shell geeksforgeeks?

1174


What is inside a seashell?

1186


How to get script name inside a script?

1064


shell script for reverse the string

1453


How to print all the arguments provided to the script?

1000


How can the contents of a file inside jar be read without extracting in a shell script?

1180


I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?

2229


What does echo $0 do?

1025


Write a command sequence to find all the files modified in less than 2 days and print the record count of each.

1588


What is the syntax of "nested if statement" in shell scripting?

1147


What are the zombie processes?

1038


Give some situations where typing error can destroy a program?

1296