Re: Unexpected behaviour: double backslash in single quotes

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

 



On Thu, Sep 6, 2018, at 09:40, Joshua Phillips wrote:
> Escape sequences don't work in single quotes:
> 
> $ echo 'hello\world'
> hello\world
> $ echo 'hello\'
> hello\
> 
> Which makes it surprising that double backslashes get converted to 
> single backslashes:
> 
> $ echo 'hello\\world'
> hello\world
> 
> Is this intended behaviour? Bash behaves as I would have expected.

This isn't just in single quotes either:

$ echo \\
\
$ echo \\\\
\

This could be quite dangerous if programs are double-escaping commands to be passed to e.g. SSH through dash.



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

  Powered by Linux