param_expand_default.tests 586 B

123456789101112131415161718192021222324252627
  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. "$THIS_SH" -c 'echo ${:-}' SHELL
  4. # now some funky ones
  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}
  17. set --
  18. set -- "${1-}"; echo 1:$#
  19. set --
  20. set -- ${1-}; echo 0:$#