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...

Create a bash shell script to sort and then
uniq the file from the command line & store it to a new
file and output the results to the screen. Name this
script "sortAndUniq.sh"

Answer Posted / vipul dalwala

$1 is the filename u are passing from commnadline

i.e. sh sortAndUniq.sh filename.txt

So $1 = filename.txt

All the commnadline parameters passed to the script are get
stored in $1 , $2, $3....

For example : sh sortAndUniq.sh filename1.txt filename2.txt
filename3.txt

Then $1 = filename1.txt , $2 = filename2.txt , $3 =
filename3.txt

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I set bash as default shell mac?

1013


What are the types of script?

1176


Explain how you Automate your application using Shell scripting.

2319


Why should we use shell scripts?

1057


I want to create a directory such that anyone in the group can create a file and access any person's file in it but none should be able to delete a file other than the one created by himself.

1034


What does $0 mean in shell script?

1006


What can scripts do?

1103


What is a command line shell?

1055


What is the first line in a shell script?

1109


What is shift command in shell script?

1043


How will you print the login names of all users on a system?

971


How to find all the files modified in less than 3 days and save the record in a text file?

1062


What is the crontab?

1089


What is path in shell script?

1097


Write down the syntax of "for " loop

1107