...
The helloWorld function captures the first two arguments into local variables txt1 and txt2, then shifts them off, storing the remaining function arguments ($@) in the rest variable. It then echos the variable values, surrounded by single quotes:
...
Initially helloWorld arguments are:
- $1 - My → stored in local variable txt1
- $2 - name → stored in local variable txt2
- $3 - is
- $4 - Anna
- $@ - My name is Anna
After shift; shift is called, helloWorld arguments are:
- My → previously now stored in local variable txt1
- name → previously now stored in local variable txt2
- $1 - is
- $2 - Anna
- $@ - is Anna → stored in local variable rest
excercise 1
How would you call the helloWorld command to produce this output?
...
We;ve already touched on difference kinds of Quoting in the shell. But there is an additional subtlety when handling script arguments.
...