Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Little problem while converting from bash (quoting/splitting?)



Hello,

I'm right now moving to zsh from bash which supposed to be straightforward
but I've encountered one problem.  Here's the log:
krasnal@szuflandia ~
$ for f in $(cleartool lsvob -short | head -10); do case $f in *gli* ) echo $f
| xxd;; esac; done
0000000: 5c67 6c69 320d 0a                        \gli2..
krasnal@szuflandia ~
$ bash
krasnal@szuflandia ~
$ for f in $(cleartool lsvob -short | head -10); do case $f in *gli* ) echo $f
| xxd;; esac; done
0000000: 5c67 6c69 320a                           \gli2.

This is with 4.2.4 cygwin version of zsh and 2.05b.0(1)-release of bash.
cleartool is windows program producing \r\n line terminated output.  Note
that zsh has both \r and \n in f variable while bash has only \n.  This is
a bit problematic for me because I'm eventually using these values for output
and the \r chars screw it up.  I've already learned that by default echo
interprets \a,\b,... sequences which I also have so I have to either use -E
or set bsd_echo option but this one is a bit puzzle for me.  Is there an
option for this (I thought sh_word_split would be the right one but there's
no change).

How should I solve this?  I mean I know I can try to strip \r which would work
for both windows and unix version but isn't there a simpler/more elegant way?

Best regards
-- 
    ____   _  ___ 
   /  | \_/ |/ _ \   Andrzej Marek Ostruszka 
  / _ |     | (_) |       MPSC (Cracow)
 /_/ L|_|V|_|\___/  (GnuPG key ID: 0x3D9C498A)



Messages sorted by: Reverse Date, Date, Thread, Author