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.

Reply to this note

Please Login to reply.

Discussion

rc is actually a better scripting language than python

i believe it.

without associative arrays? nah

just use awk (p9p awk not the gnu one)