delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/08/30/09:34:28

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; q=dns; s=default; b=DT6la8J+S82DNNYGy+TRFdsgkkzme
vpRZs0AMI1AOOfpEtlO+WpEu+7O/pIWcoiSg2ZHF2cE64g71XXm+7isA5BINdR/N
NFheDYpsTh7kggrtz7Rx4BYxbo7AdEIQKPwRBWRZdXo0+A9g65ruzlOgzHpQo1v2
XiGomvj8qfNffY=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; s=default; bh=BucyxZkpQovROaLqErliuxDZSSU=; b=MWm
kq6uxuikrsge+gute2jf6WfxXooqPO5vPi3OMpC0eTkNXu7sOYgKTa15/P91cas5
f7WxEP2iccguNWiGY0ltR5qgp3L8iPq2pacv2GV/IAQt5y9x1ytwdGf7GEnQMUka
k3AJUoSdlZsf47/XXWG5zra0PKCIN90JCFH7pgXs=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_20,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=Nellis, nellis, Hx-languages-length:1685, H*f:sk:1814462
X-HELO: USA7109MR002.ACS-INC.COM
From: "Nellis, Kenneth" <Kenneth DOT Nellis AT xerox DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: RE: bash: igncr shell option breaks my PS1 prompt
Date: Tue, 30 Aug 2016 13:34:07 +0000
Message-ID: <0D835E9B9CD07F40A48423F80D3B5A704BB92AEC@USA7109MB022.na.xerox.net>
References: <181446230 DOT 20160830061415 AT yandex DOT ru>
In-Reply-To: <181446230.20160830061415@yandex.ru>
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u7UDYPcc002692

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019