atyh on Nostr: TIL, in the rc shell, arrays of strings in a variable are assigned a positional ...
TIL,
in the rc shell, arrays of strings in a variable are assigned a positional parameter.
meaning,
var=(thing1 thing2 thing3 thing4)
automatically make:
echo $var(2) possible, with the result being "thing2"
or even:
echo $var(3 1 2) with the result being "thing3" "thing1" "thing2"
and the number of strings in a variable can be found with:
echo $#var
thats... dope.
in the rc shell, arrays of strings in a variable are assigned a positional parameter.
meaning,
var=(thing1 thing2 thing3 thing4)
automatically make:
echo $var(2) possible, with the result being "thing2"
or even:
echo $var(3 1 2) with the result being "thing3" "thing1" "thing2"
and the number of strings in a variable can be found with:
echo $#var
thats... dope.