[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Weird set -u error



Hi,

tomas@tuxteam.de wrote:
> Why {PS1:+x} rather than {PS1:-}?

It seemed to be the nearest suitable variation which was similar to the
proposal
  [ ${var+x} ]
in
  https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash
where one can see a nice table of ${VARIABLE...} tricks:
  parameter expansion 	VARIABLE set 	VARIABLE empty 	VARIABLE unset
  ...
>From the hint that it is defined by POSIX i got to the table at
  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
under "2.6.2 Parameter Expansion".


As stated at other occasions, my shell mindset is still from the late 1980s
when the choice was Bourne shell or C shell. When newer skills are needed,
i search the web or look into my own existing scripts.


Have a nice day :)

Thomas


Reply to: