jeudi 6 août 2020

Check if a variable is undefined or empty in single if-condition in csh

The variable existence and empty values can be checked in separate if-conditions in csh.

if (! $?theVar) then

or

if ($theVar == "") then

I would like to check these conditions in a single condition. Tried something like

if ((! $?theVar) || ($theVar == "")) then

But it is not working as expected. It seems to be simple and I couldn't find a similar question. Please feel free to point it, if the question already exists.

Note: Can't change the shell. Need solution in csh only.

Aucun commentaire:

Enregistrer un commentaire