Why don't I need to use bash indirection with string substitution?
0
votes
1
answer
151
views
One challenging thing I've encountered in bash scripting is using variable expansion in a recursive way.
However, I was able to figure out [through ChatGPT] that I could use indirect subsitution to reference positional parameter values:
linkerArgs+=("${!i}")
However, if I am using string substitution, it's fine for me to just use expansion in a recursive manner as you would figure logically:
"${x// /$newChar}"
Why does the bash interpreter consider the latter type of expansion (with just the dollar sign inside the brackets) as "bad substitution" when used in the context of assigning items to an array, but not with string substitution?
Asked by thinksinbinary
(217 rep)
Jun 6, 2023, 02:15 AM
Last activity: Jun 6, 2023, 06:52 PM
Last activity: Jun 6, 2023, 06:52 PM