How do you save all the arguments in a bash script to an array and print them individually?
Initialize the array:
ARGS=("$@") # "$@" gives the arguments passed to the script
ARGS=(arg1 arg2 arg3) # or fill the array out yourself
Display the array items:
for ARG in "${ARGS[@]}"; do
printf '%s\n' "$ARG"
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With