param_expand_default.tests 591 B

1234567891011121314151617181920212223
  1. # first try some invalid patterns (do in subshell due to parsing error)
  2. # (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages)
  3. # valid in bash and ash (same as $-): "$THIS_SH" -c 'echo ${-}' SHELL
  4. "$THIS_SH" -c 'echo ${:-}' SHELL
  5. # now some funky ones
  6. echo _${#-} _${#:-}
  7. # now some valid ones
  8. set --
  9. echo _$1 _${1-} _${1:-} _${1-word} _${1:-word}
  10. set -- aaaa
  11. echo _$1 _${1-} _${1:-} _${1-word} _${1:-word}
  12. unset f
  13. echo _$f _${f-} _${f:-} _${f-word} _${f:-word}
  14. f=
  15. echo _$f _${f-} _${f:-} _${f-word} _${f:-word}
  16. f=fff
  17. echo _$f _${f-} _${f:-} _${f-word} _${f:-word}