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

See info zsh 'Parameter Expansion':

${NAME-WORD}
${NAME:-WORD}
If NAME is set, or in the second form is non-null, then substitute its value; otherwise substitute WORD. In the second form NAME may be omitted, in which case WORD is always substituted.

That's a feature inherited from the Bourne shell (from the late 70s) and present in all Bourne-like or POSIX shells (except for the last part about omitting NAME which is a zsh-specific extension).

So ${XDG_CONFIG_HOME:-$HOME/.config} expands to the value of the XDG_CONFIG_HOME variable if non-empty or to $HOME/.config otherwise.

Given that XDG_CONFIG_HOME has been defined to something guaranteed to be non-empty above, it's redundant indeed.

See info zsh 'Parameter Expansion':

${NAME-WORD}
${NAME:-WORD}
If NAME is set, or in the second form is non-null, then substitute its value; otherwise substitute WORD. In the second form NAME may be omitted, in which case WORD is always substituted.

That's a feature inherited from the Bourne shell (from the late 70s) and present in all Bourne-like or POSIX shells.

So ${XDG_CONFIG_HOME:-$HOME/.config} expands to the value of the XDG_CONFIG_HOME variable if non-empty or to $HOME/.config otherwise.

Given that XDG_CONFIG_HOME has been defined to something guaranteed to be non-empty above, it's redundant indeed.

See info zsh 'Parameter Expansion':

${NAME-WORD}
${NAME:-WORD}
If NAME is set, or in the second form is non-null, then substitute its value; otherwise substitute WORD. In the second form NAME may be omitted, in which case WORD is always substituted.

That's a feature inherited from the Bourne shell (from the late 70s) and present in all Bourne-like or POSIX shells (except for the last part about omitting NAME which is a zsh-specific extension).

So ${XDG_CONFIG_HOME:-$HOME/.config} expands to the value of the XDG_CONFIG_HOME variable if non-empty or to $HOME/.config otherwise.

Given that XDG_CONFIG_HOME has been defined to something guaranteed to be non-empty above, it's redundant indeed.

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

See info zsh 'Parameter Expansion':

${NAME-WORD}
${NAME:-WORD}
If NAME is set, or in the second form is non-null, then substitute its value; otherwise substitute WORD. In the second form NAME may be omitted, in which case WORD is always substituted.

That's a feature inherited from the Bourne shell (from the late 70s) and present in all Bourne-like or POSIX shells.

So ${XDG_CONFIG_HOME:-$HOME/.config} expands to the value of the XDG_CONFIG_HOME variable if non-empty or to $HOME/.config otherwise.

Given that XDG_CONFIG_HOME has been defined to something guaranteed to be non-empty above, it's redundant indeed.