Artificial intelligent assistant

ksh variable declaration and loop I need to work and understand a ksh script. The variable declaration is done in a different way I am used to: STA=${1:-blabla} I don't really understand what does the "1:-" stands for? Is it possible to make a loop with this variable declaration such as: STA=${1:-blabla blabla2 blabla3}

`${var:-x}` means "if var is unset or empty, replace it with x". As such it depends on what you mean by "mak[ing] a loop".

If you make a loop by splitting on `$IFS`, then yes, you can use this to create a variable for a loop. However, if that's what you want to do, I'd recommend using a ksh array instead:


if [ "$#" -eq 0 ]; then
set -A sta blabla blabla2 blabla3 # ksh88/pdksh/mksh/ksh93
sta=(blabla blabla2 blabla3) # ksh93/mksh
else
sta=("$@") # use the positional parameters if provided
fi

for x in "${sta[@]}"; do [...]

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b273e447d97f03011a0a524cf5089131