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

Which is better perl or shell scripting?

553


What is the command to find out users on the system?

568


What are types of shells?

539


What are scripts in psychology?

588


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

583






What does $@ mean in shell?

588


What is $1 in shell scripting?

585


What is awk in shell scripting?

548


Is bash an operating system?

542


Write a command sequence to find the count of each word?

536


What is a shell in operating system?

585


What does .sh file contain?

548


What is shell company all about?

566


Is powershell a language?

556


What is the use of echo in shell script?

537