Re: [PATCH v2] expand: Do not quote backslashes in unquoted parameter expansion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 28, 2018 at 12:53:31PM +0200, Harald van Dijk wrote:
>
> I don't think this allows dash's behaviour of taking the backslash as a
> literal, since that still allows a match to succeed. bash lets such a
> pattern never match. In other shells, there is no way to get into this
> situation, but GNU find behaves the same as bash.

Nope, bash treats it as if the backslash is not there.

$ pwd
/home/dash
$ touch asdf\\
$ touch asdf
$ bash -c 'v="../da*sh/asdf\\"; printf "%s\n" $v'
../dash/asdf
$ 

> Test case:
> 
>   v=\\; case \\ in $v) echo bug;; esac
> 
> bash prints nothing, dash 0.5.9.1 prints bug. Other shells don't count since
> they interpret $v differently.

Indeed bash seems to do something different for case matches.

Since bash itself is inconsistent, and POSIX unclear, I have opted
to be consistent with existing dash behaviour.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux