param_expand_default.tests 621 B

123456789101112131415161718192021222324
  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 $-), not supported in hush (yet?):
  4. "$THIS_SH" -c 'echo ${-}' SHELL
  5. "$THIS_SH" -c 'echo ${:-}' SHELL
  6. # now some funky ones
  7. echo _${#-} _${#:-}
  8. # now some valid ones
  9. set --
  10. echo _$1 _${1-} _${1:-} _${1-word} _${1:-word}
  11. set -- aaaa
  12. echo _$1 _${1-} _${1:-} _${1-word} _${1:-word}
  13. unset f
  14. echo _$f _${f-} _${f:-} _${f-word} _${f:-word}
  15. f=
  16. echo _$f _${f-} _${f:-} _${f-word} _${f:-word}
  17. f=fff
  18. echo _$f _${f-} _${f:-} _${f-word} _${f:-word}