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

How do you read arguments in a shell program - $1, $2 ..?

Answer Posted / seshadri sethi

Shell script accepts parameters in following format…
$1 would be the first command line argument, $2 the second,
and so on
$0 is the name of the script or function

If your script has more than 9 params then accept in
following way…
${12} : 12th param
${18} : 18th param

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does the sh command do?

1073


What exactly is a shell?

1070


Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.

2466


What is difference between shell and bash scripting?

980


Is scripting and coding the same thing?

974


What is the use of a shebang line?

1186


What is bash command used for?

1062


What makes c shell a more preferable option than the bourne shell?

970


Is shell scripting a language?

1033


Why are there shells on the beach?

1137


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.

1027


What lives in a shell?

954


How will you pass and access arguments to a script in linux?

1143


What are the different types of shell scripting?

1101


Print the 10th line without using tail and head command.

2168