Questions tagged [indirection]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
155 views

/bin/sh shell indirect reference syntax - why does it have to be that way?

This might be a question of eval command, but anyway, I'm having a hard time to understand the syntax of /bin/sh indirect reference. I usually write bash scripts, ${!val} way, so I wasn't thinking ...
2
votes
2answers
119 views

How many levels of indirection can I apply in Bash?

In bash, I understand we can have variable indirect expansion via two ways: Using declare: declare -n foo=bar Using the ${!..} expansion. We can combine both: declare -n foo=SHELL bar=foo echo ${!...
2
votes
2answers
71 views

How to access further members of an array when using bash variable indirection?

Consider the following example, it seems it's working fine with the index 0: $ a1=(1 2 3) $ a2=(a b c) $ for x in a1 a2; do echo "${!x}"; done 1 a $ for x in a1 a2; do echo "${!x[0]}"; done 1 a ...