variable handling in ash

David Collier from_busybox_maillist at dexdyne.com
Sat Mar 5 10:34:00 UTC 2011


I'm new to bash/ash scripting, and I've asked about previously to see if
there's a doc/manual for ash, as opposed to bash.

I found something I didn't understand in a script, and did a bit of
research, finding out that there are a whole pile of things you can do
to/with variables. Most of them were new to me.

Now some of these are marked as "only in bash version xxx or later" - so
I've no idea what work in ash.

Of course I could spend half a day writing test cases.... but it's not
allowed for in my current work schedule :-)

So the question is - can I read up on which of the features listed below
is supported by ash. Failing that, does anyone have the info at their
fingertips, or know of a test suite ready-built?

TVM

David

$var
${var}
${var-eval_if_unset}
${var:-eval_if_unset }
${var=assign_if_unset}
${var:=assign_if_unset }
${var+subs_if_set}
${var:+subs_if_set}
${!var[@]}
${!var[*]}
${var?err_msg}
${var:?err_msg}
${#var}
$#
${#*}
${#@}
${#array[*]}
${#array[@]}
${var#Pattern},
${var##Pattern},
${var%Pattern},
${var%%Pattern},
${var:pos}
${var:pos:len}
${var:pos:len}
${var/Pattern/Replacement}
${var//Pattern/Replacement}
${var/#Pattern/Replacement}
${var/%Pattern/Replacement}
${!prefix*}
${!prefix@}
${!var}
${!array[@]}
${!array[*]}
${parameter^pattern}
${parameter^^pattern}
${parameter,pattern}
${parameter,,pattern
When ‘@’ is used and the expansion appears within double quotes, each key
expands to a separate word  separated by the first character of the IFS
special variable


More information about the busybox mailing list