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

Re: string overwrites string when echoed



On Sun, 10 Sep 2017 18:35:25 +0200
Emanuel Berg <moasen@xxxxxxxx> wrote:
> Bart Schaefer wrote:
> 
> > The value of $reply has an embedded
> > carriage-return. You can see this if you use:
> >
> >     echo "$u ${(V)reply}" echo "${(V)reply} $u"
> 
> echo "${(V)reply} $u" works, only how do I drop
> the ^M then?

Replacing $reply with ${reply%%$'\r'} would do the trick.

There may be something you can do with stty, but that's
a bit out of the scope of the shell (or indeed sanity :-().

pws



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