Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Handling Double-quoted backslash
- X-seq: zsh-users 15073
- From: EG Galano <eg.galano@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Handling Double-quoted backslash
- Date: Fri, 21 May 2010 20:58:30 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=iukgTfY5CW+CTdEzx4PWXdH4hmCrHyEIxpideNtWuaw=; b=GkhCsYeFpKFAo51/SvzH0OZPlhYv+zkueaAHWnc7N5rCA4dXlpiUFgVdMFeFj8ydTx 4Ztsm88Fwjxy7f6l9idQ7zK+v1n65ADyS+yinde/Rax1EKLod+oNUzEaD1DM/bABDbem XTEWOjdkGReCfoShzrcatNSYE7MhDurVMUMWU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HRE2mxAOxXbB2NO4m3Cc99BXiPJrNFcbTUn4qSLXa+lte8wmaRJ2REbr5iarlB58KW jXA4xDwHtDB1P62vFc6hSDOsTvOP0mvvdn7YFyh5h/87rIo5+cqHj5g+wYE7jX6T2rsD xSSjyrmOmW/78e/6ucvjge81T6KQpwf8D2CPs=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
I'm not certain if this is a bug because many different shells handle
the case differently. I started testing double-quoted backslashes with
the newline character to see how the different shells handled the
following commands. I'm no expert, but based on what I've learned
about escaping
charcters, I would think TCSH is the only one that handles it
correctly. Is that not correct?
bash
eg@eg-laptop:~$ echo "a\nb"
a\nb
eg@eg-laptop:~$ echo "a\\nb"
a\nb
eg@eg-laptop:~$ echo "a\\\nb"
a\\nb
zsh
eg-laptop% echo "a\nb"
a
b
eg-laptop% echo "a\\nb"
a
b
eg-laptop% echo "a\\\nb"
a\nb
csh
% echo "a\nb"
a\nb
% echo "a\\nb"
a\\nb
% echo "a\\\nb"
a\\\nb
tcsh
eg-laptop:t> echo "a\nb"
a
b
eg-laptop:> echo "a\\nb"
a\nb
eg-laptop:> echo "a\\\nb"
a\
b
eg@eg-laptop:~/$ sh
$ echo "a\nb"
a
b
$ echo "a\\nb"
a
b
$ echo "a\\\nb"
a\nb
ksh shell
$ echo "a\nb"
a\nb
$ echo "a\\nb"
a\nb
$ echo "a\\\nb"
a\\nb
fish shell
eg@eg-laptop ~/t> echo "a\nb"
a\nb
eg@eg-laptop ~/> echo "a\\nb"
a\nb
eg@eg-laptop ~/> echo "a\\\nb"
a\\nb
eg@eg-laptop:~/wine-git$ psh
psh% echo "a\nb"
a
b
psh% echo "a\\nb"
a\
b
psh% echo "a\\\nb"
a\
b
Messages sorted by:
Reverse Date,
Date,
Thread,
Author