...
The helloWorld 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:
Code Block | ||
---|---|---|
| ||
function helloWorld() { local txt1=$1 local txt2=$2 shift; shift local rest=$@ echo "Hello World!" echo " text 1: '$txt1'" echo " text 2: '$txt2'" echo " rest: '$rest'" } |
...