Skip to main content
added 8 characters in body
Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k

The POSIX shell (so includes bash) equivalent would be:

${FOO:-${BAR:-default}} 

See also the:

${FOO-${BAR-default}} 

Whichvariant which checks whether the variable is set or not instead of whether it resolves to the empty string or not (which makes a difference in the cases where a variable is set but empty).

The POSIX shell (so includes bash) equivalent would be:

${FOO:-${BAR:-default}} 

See also the:

${FOO-${BAR-default}} 

Which checks whether the variable is set or not instead of whether it resolves to the empty string or not (which makes a difference in the cases where a variable is set but empty).

The POSIX shell (so includes bash) equivalent would be:

${FOO:-${BAR:-default}} 

See also the:

${FOO-${BAR-default}} 

variant which checks whether the variable is set or not instead of whether it resolves to the empty string or not (which makes a difference in the cases where a variable is set but empty).

Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k

The POSIX shell (so includes bash) equivalent would be:

${FOO:-${BAR:-default}} 

See also the:

${FOO-${BAR-default}} 

Which checks whether the variable is set or not instead of whether it resolves to the empty string or not (which makes a difference in the cases where a variable is set but empty).