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
Explain about the slow execution speed of shells?
What is echo $shell?
What is the way to do multilevel if-else's in shell scripting?
What are the different types of commonly used shells on a typical linux system?
How do you debug a script?
What are the different types of variables used in shell script?
What is meant by dos operating system?
How do I save a powershell script?
Explain about return code?
Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.
Write a command sequence to find the count of each word?
What is shell variable?
What does echo $0 do?
Give some situations where typing error can destroy a program?
What is shell scripting?