$@
instead. In the following example, I took in the entire string and
print it out word by word after breaking them into a string array
according to the spaces in between. In script run_this.sh:
userInputs=($@)
for i in "${userInputs[@]}";; do
echo "$i"
done
Running the command:
./run_this.sh who knows how long this can go
who
knows
how
long
this
can
go
source: https://medium.freecodecamp.org/functional-and-flexible-shell-scripting-tricks-a2d693be2dd4