check a list of vars

I have about 20 different variables that I need to check for null values then replace with a specific string if they are null. I've been doing this via 20 different if then statements like this:

if [ "$VAR1" = "" ]; then
WIND="UUU"
fi

Is there a more elegant way to do this? The vars aren't sequential in their name by the way. Thanks for the suggestions as always!

I don't think you have any other choice.

Regards

It's not clear what you are replacing but perhaps echo ${VAR1-UUU} and other shell variable substitution mechanisms would help here.

Check if your shell supports the below syntax:

Thanks for the replies, all. I'm using BASH for this script. That ${parameter:=word} syntax is foreign to me...

That's a basic parameter expansion available in all Bourne-type shells (which includes bash and ksh).

: ${var1:=UUU} ${othervar:=XXX} ${myvar:=MEMEME}

Thanks for the info, all. It works very well and in a single line of code!