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
What does the sh command do?
What exactly is a shell?
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.
What is difference between shell and bash scripting?
Is scripting and coding the same thing?
What is the use of a shebang line?
What is bash command used for?
What makes c shell a more preferable option than the bourne shell?
Is shell scripting a language?
Why are there shells on the beach?
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.
What lives in a shell?
How will you pass and access arguments to a script in linux?
What are the different types of shell scripting?
Print the 10th line without using tail and head command.