Denis Vlasenko | afdcd12 | 2008-07-05 17:40:04 +0000 | [diff] [blame] | 1 | if test $# != 0; then |
| 2 | exec "$THIS_SH" "$0" |
| 3 | fi |
| 4 | |
| 5 | # No params! |
| 6 | for a in "$*"; do echo Should be printed; done |
| 7 | for a in "$@"; do echo Should not be printed; done |
| 8 | # Yes, believe it or not, bash is mesmerized by "$@" and stops |
| 9 | # treating "" as "this word cannot be expanded to nothing, |
| 10 | # but must be at least null string". Now it can be expanded to nothing. |
Denys Vlasenko | 6e42b89 | 2011-08-01 18:16:43 +0200 | [diff] [blame^] | 11 | for a in "$@"""; do echo Would not be printed by bash; done |
| 12 | for a in """$@"; do echo Would not be printed by bash; done |
| 13 | for a in """$@"''"$@"''; do echo Would not be printed by bash; done |
Denis Vlasenko | afdcd12 | 2008-07-05 17:40:04 +0000 | [diff] [blame] | 14 | for a in ""; do echo Should be printed; done |
Denis Vlasenko | a8b6dff | 2009-03-20 12:05:14 +0000 | [diff] [blame] | 15 | |
Denis Vlasenko | feecc7b | 2009-03-20 12:12:33 +0000 | [diff] [blame] | 16 | # Bug 207: "$@" expands to nothing, and we erroneously glob "%s\n" twice: |
| 17 | printf 'Empty:%s\n' "$@" |
| 18 | printf "Empty:%s\n" "$@" |
Denis Vlasenko | a8b6dff | 2009-03-20 12:05:14 +0000 | [diff] [blame] | 19 | printf "Empty:%s\\n" "$@" |