Hi all,
I have written an if statement of the form:
if [ -n "${VAR:-x}" ]; then
#do something
export VAR=#something
fi
My shell script calls this statement twice and surprisingly passes the condition twice.
[hint (perhaps...): This exact code is repeated in a function in an included file. The if statement is first evaluated prior to function invocation. It is "again" evaluated when the function is invoked.]
What is the matter here? Do I understand the -x flag incorrectly?
Thanks!