param_expand_alt.tests 520 B

12345678910111213141516171819202122
  1. # first try some invalid patterns (do in subshell due to parsing error)
  2. "$THIS_SH" -c 'echo ${+} ; echo moo'
  3. "$THIS_SH" -c 'echo ${:+} ; echo moo'
  4. # now some funky ones. (bash doesn't accept ${#+})
  5. echo _${#+}_ _${#:+}_
  6. # now some valid ones
  7. set --
  8. echo _$1 _${1+} _${1:+} _${1+word} _${1:+word}
  9. set -- aaaa
  10. echo _$1 _${1+} _${1:+} _${1+word} _${1:+word}
  11. unset f
  12. echo _$f _${f+} _${f:+} _${f+word} _${f:+word}
  13. f=
  14. echo _$f _${f+} _${f:+} _${f+word} _${f:+word}
  15. f=fff
  16. echo _$f _${f+} _${f:+} _${f+word} _${f:+word}