This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: bash: igncr shell option breaks my PS1 prompt
- From: "Nellis, Kenneth" <Kenneth dot Nellis at xerox dot com>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Tue, 30 Aug 2016 13:34:07 +0000
- Subject: RE: bash: igncr shell option breaks my PS1 prompt
- Authentication-results: sourceware.org; auth=none
- References: <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