public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrey Repin <anrdaemon@yandex.ru>
To: Gene Pavlovsky <gene.pavlovsky@gmail.com>, cygwin@cygwin.com
Subject: Re: bash: igncr shell option breaks my PS1 prompt
Date: Sat, 27 Aug 2016 18:31:00 -0000	[thread overview]
Message-ID: <1793486.20160827192654@yandex.ru> (raw)
In-Reply-To: <CAPTiy3PE0gZ-hpvQbxVkfaZfxtppDx7RG85WtuigpnL54WZbDA@mail.gmail.com>

Greetings, Gene Pavlovsky!

> # PS1='\e[1;30m\D{%T}\e[m$(test \j -ne 0 && echo "\e[1;37mj:\j\e[m")${STY:+ \e[1;32m${STY%%.*}\e[m} \e[1;33m\w\e[m\n# '
> 14:32:22 /usr/local/bin
> # set -o igncr
> bash: command substitution: line 1: syntax error near unexpected token `)'
> bash: command substitution: line 1: `test 0 -ne 0 && echo " j:0")'
> 14:32:24{STY:+ } /usr/local/bin
> # set +o igncr
> 14:32:26 /usr/local/bin
> #

> What's wrong with this? It works fine on a Linux box.

Try using printf instead of echo, and explicitly quote any dubious characters.

> I'm considering rolling back bash until I can figure this out.

> I really think it was an unwise move to hastily modify the `read` bash
> built-in's behavior without a lot of testing. And basically now I
> should either put Cygwin-specific checks (if cygwin, then set igncr
> shell option) in all of my scripts that *might* be affected, or be
> forced to set igncr shell option system-wide, which I'd prefer not to
> do.

I don't understand, WHY it was modified, if at all.
But did you check the other side of your issue? Does the tool you read from
prints CRLF EOL? And if it is ONLY CRLF, and not CRCRLF, like some silly
things do.

> Can't imagine I'm the only guy whose scripts might be getting weird
> problems now. Unless everybody been using `igncr` shell option (off by
> default) for ages, and I'm the only guy who just heard about that?

Everybody not using CR's for ages to begin with.

> Personally I don't like the `igncr` option's behavior. I want my bash
> scripts to fail if somebody saved (or checked out from git) with CRLF
> line endings. If it happens, I will notice immediately and then fix
> them. Don't want to have bash scripts with CRLF line endings lurking
> on my system, pretending to be nice - then one day I'll copy one to my
> Linux box where it will break, surprising me more than when I first
> created it or checked out from git.

Again, I feel like your analysis is lacking and/or you are mixing things.


-- 
With best regards,
Andrey Repin
Saturday, August 27, 2016 19:16:33

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2016-08-27 16:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-27 16:20 Gene Pavlovsky
2016-08-27 18:31 ` Andrey Repin [this message]
2016-08-29  5:18 ` Gene Pavlovsky
2016-08-30  2:21   ` Eric Blake
2016-08-30  7:49     ` Andrey Repin
2016-08-30 16:57       ` Nellis, Kenneth
2016-08-30 17:38         ` Houder
2016-08-30 13:16     ` Houder
2016-08-30 17:04       ` Eric Blake
2016-08-30 20:50         ` Houder
2016-09-02 11:52         ` Gene Pavlovsky
2016-09-02 13:32           ` Eric Blake
2016-09-04  9:11             ` Gene Pavlovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1793486.20160827192654@yandex.ru \
    --to=anrdaemon@yandex.ru \
    --cc=cygwin@cygwin.com \
    --cc=gene.pavlovsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).