My script takes a list of files as arguments.  I want to add new argument to $@ array. For a normal array named files, appending to the array would be files+=(name_here.png). How do to I append to $@?
I would refer to @hek2mgl answer as the best array-specific answer, but if your goal is to explicitly extend $@ then go with this:
set -- "$@" '/path/to/file1' '/path/to/file2'
                        I would copy $@ to an array and append to that:
files=( "${@}" )
files+=( name_here.png )
Then use ${files} in the script rather than ${@}.
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