What is the use of "shift" command in passing parameters?
Answer / satchi
"shift" is useful when you need to access positional
parameters more than 9.
EX- execute a script to display 11th position parameter.
#./test.sh 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
12th
shell scripts limits the access of arguments up to 9.to
over come this calculate the position of argument you want
to access and use shift to pull inside 9th countdown.
ex:
withen the script write "shift 2" before "echo $9"to
display 11th parameter.
withen the script write "shift 3" before "echo $9"to
display 12th parameter.
| Is This Answer Correct ? | 8 Yes | 1 No |
What is the meaning of $1 in shell script?
What is shift command in shell script?
What are the types of script?
What are the different commands available to check the disk usage?
How shell works?
How can you get the value of pi till a 100 decimal places?
What is the difference between break and continue commands?
What is "test"? How it is used in shell scripting?
write a shell script to check whether all the directories in the path exist has read and write permission
Please anyone suggest atleast 2 good training institutes in Hyderabad, INDIA where i can learn unix shell scripting.
What is the syntax of "nested if statement" in shell scripting?
What are filters explain sort with all the options available?