Mike Frysinger | 78f9d8e | 2009-03-28 18:55:34 +0000 | [diff] [blame] | 1 | # first try some invalid patterns (do in subshell due to parsing error) |
Denys Vlasenko | be669fa | 2017-07-25 15:25:07 +0200 | [diff] [blame] | 2 | # (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages) |
Denys Vlasenko | be669fa | 2017-07-25 15:25:07 +0200 | [diff] [blame] | 3 | "$THIS_SH" -c 'echo ${:-}' SHELL |
Mike Frysinger | 78f9d8e | 2009-03-28 18:55:34 +0000 | [diff] [blame] | 4 | |
| 5 | # now some funky ones |
| 6 | echo _${#-} _${#:-} |
| 7 | |
| 8 | # now some valid ones |
| 9 | set -- |
| 10 | echo _$1 _${1-} _${1:-} _${1-word} _${1:-word} |
| 11 | |
| 12 | set -- aaaa |
| 13 | echo _$1 _${1-} _${1:-} _${1-word} _${1:-word} |
| 14 | |
| 15 | unset f |
| 16 | echo _$f _${f-} _${f:-} _${f-word} _${f:-word} |
| 17 | |
| 18 | f= |
| 19 | echo _$f _${f-} _${f:-} _${f-word} _${f:-word} |
| 20 | |
| 21 | f=fff |
| 22 | echo _$f _${f-} _${f:-} _${f-word} _${f:-word} |
Denys Vlasenko | 9e0adb9 | 2019-05-15 13:39:19 +0200 | [diff] [blame] | 23 | |
| 24 | set -- |
| 25 | set -- "${1-}"; echo 1:$# |
| 26 | set -- |
| 27 | set -- ${1-}; echo 0:$# |