public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Nellis, Kenneth" <Kenneth.Nellis@xerox.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: bash: igncr shell option breaks my PS1 prompt
Date: Tue, 30 Aug 2016 16:57:00 -0000	[thread overview]
Message-ID: <0D835E9B9CD07F40A48423F80D3B5A704BB92AEC@USA7109MB022.na.xerox.net> (raw)
In-Reply-To: <181446230.20160830061415@yandex.ru>

From: Andrey Repin 
> 
> Greetings, Eric Blake!
> 
> > But it seems like \n handling in PS1 is independent of any change in
> > handing in the 'read' builtin.  As evidence, I ran the following test
> > using the older bash-4.3.42-4 build:
> 
> > $ bash-4.3.42-4
> > $ set -o igncr
> > $ PS1='$(date)\n# '
> > bash: command substitution: line 1: syntax error near unexpected token
> ')'
> > bash: command substitution: line 1: `date)'
> 
> That's interesting.
> 
> I've just tried it on Linux.
> 
> $ PS1='$(date)\n\$ '
> Tue Aug 30 06:10:48 MSK 2016
> $ bash --version
> GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
> 
> (No idea why they ship this ancient version...)
> And on Cygwin
> 
> $ PS1='$(date)\n\$ '
> Tue Aug 30 06:12:38 MSK 2016
> $ bash --version
> GNU bash, version 4.3.46(6)-release (x86_64-unknown-cygwin)
> $ set -o igncr
> -bash: command substitution: line 1: syntax error near unexpected token
> `)'
> -bash: command substitution: line 1: `date)'
> 
> > $ exit
> 
> > So you have uncovered a latent problem, unrelated to the recent igncr
> > fixes, but which is indeed tied to the overall igncr patches, and which
> > you had no reason to trip over until the igncr change to 'read' changed
> > your desire to use igncr.
> 
> Seems like it is related, at least in some way.

But, get this:

$ PS1='$(date)\n\$ '
Tue Aug 30 09:30:37 EDT 2016
$ set -o igncr
-bash: command substitution: line 1: syntax error near unexpected token `)'
-bash: command substitution: line 1: `date)'

$ PS1='`date`\n\$ '
Tue Aug 30 09:31:01 EDT 2016
$

So, the $() syntax is part of the mix. Use back-ticks as a workaround.

--Ken Nellis

--
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-30 13:34 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
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 [this message]
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=0D835E9B9CD07F40A48423F80D3B5A704BB92AEC@USA7109MB022.na.xerox.net \
    --to=kenneth.nellis@xerox.com \
    --cc=cygwin@cygwin.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).