Re: [PATCH] shell portability: Use sed instead of non-portable variable expansion
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 5, 2011, 07:15 UTC
- Message-ID
- <7v7h5nxxwf.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <4E647442.9000005@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 11 quoted lines
>> run_backend() {
>> echo "$2" |
>> - QUERY_STRING="${1#*\?}" \
>> - PATH_TRANSLATED="$HTTPD_DOCUMENT_ROOT_PATH/${1%%\?*}" \
>
> What happens if you write these as
>
> QUERY_STRING=${1#*\?} \
> PATH_TRANSLATED=$HTTPD_DOCUMENT_ROOT_PATH/${1%%\?*} \
>
> i.e., drop the double-quotes?Interesting. Your conjecture is that the shell may be dropping the backslash inside dq context when it does not understand what follows the backslash, i.e. "\?" -> "?", losing the quote. I find it very plausible.
If that is the case, either the above or my [?] would work it around, I would think.
Thanks.