delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/04/05/13:29:55

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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=KBzdsGHwthGN0+ER
4YaAp4ZL9Yx9L5SY+eRvWHSET9WGQlSXtJfTKcdHkHoq94AnqbCtHrV8Y3scfclz
VdVLO/Bg/e5ohg2luG1/esDkA0wK+pGNwwnol3hITd3BFl7LMpuJove05Xm0Qrt4
6EGoGxvLWmmG71Nmv7wuf0beyPU=
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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=B8Tl6b+4R4649CRBaYEC5u
J7BOU=; b=CG2Osgpr/r0RZd+oiK867A/lhloPEd+2UL5WGcWerErt3boLd5XE4e
DQmzUW9ykRUkHn8s2t6LhVnmbK2mQRgjLJRa0B3skQoRXm8SOvrUeTanLFjOweiK
sAV8R4l/UWv27jI03JtyqnjrZsSfCB1W+nxvtgnJledr937fQ8eu8=
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=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*i:sk:1661013, H*f:sk:1661013, H*MI:sk:1661013, Hx-languages-length:1479
X-HELO: mail-it0-f51.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=7a6GCmz7Ugf81X0mqazRuxq9XkICSoQvRNmk9ouwWww=; b=f6oZJGTx/1lr60fA5mZQIR6FugPyTa2+WJWLjK3EIt4rhDUFrq1rx9jl5ka5prj5mg gSsW2hMZpkQw0UFhWdxbUrSMZTy0hCT7NIdJF5DdKTBsxgpYAm6p+XcO8+7ITxWqUdnR TcpKTQhqFqLNe4QmCffizhtnSh2sG5+Z3RCmfouPfzRIPN5Q/aoJjDDyLsXWS1z6qpx/ lqzDv/mGDv9RGVd4FmU5YIn7M8m8E+4R1tsXWIe8TCHgS8AHdebosrKfCiDYzk97O0o3 faV6zKpHOXyDbQ6DXGytKkFxcnRdFM/wNadTmpThe758dMk4jtq87vOf2olR5liF8OLk T4Kg==
X-Gm-Message-State: AFeK/H0dfV/hCWwM0+O5cAXStLJGSykWmuDHt6930Ica5mORc0U11fcsHcQrjI5WCqEwXA==
X-Received: by 10.36.170.68 with SMTP id y4mr21700423iti.7.1491413341238; Wed, 05 Apr 2017 10:29:01 -0700 (PDT)
Subject: Re: Why does default shell prompt PS1 contain newlines (\n)?
To: cygwin AT cygwin DOT com
References: <1661013492 DOT 3298 DOT 1491411213549 AT communicator DOT strato DOT com>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <3967f489-c760-4d91-6d9f-5b645b4b3647@gmail.com>
Date: Wed, 5 Apr 2017 13:28:46 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <1661013492.3298.1491411213549@communicator.strato.com>
X-IsSubscribed: yes


On 4/5/2017 12:53 PM, "\"[[\"Dr. Matthias H. Fröhlich" wrote:
> After installing "plain vanilla" cygwin I noticed, that default definition of PS1 from /etc/bash.bashrc contains newline characters '\n':
>      # Set a default prompt of: user AT host and current_directory
>      PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
> 
> This does immediately lead to the strange effect, that shell (bash) in interactive terminal window (C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -) always advances 2 lines on every single CR.
> 

It's not strange at all.  You get an empty line, followed by a line
containing "USER AT HOSTNAME WORKING-DIRECTORY" and finally followed by a
line containing the "$ ".

The empty line helps to identify the prompt text from text that may
appear on the terminal from commands.  Part of the string also modifies
the Window title with the current working directory.  Part of the string
controls the color of the prompt text.

> This definition seems to be around pretty long already, as it is mentioned in several discussions on superuser &c. There is probably a very good reason for this - however, I could not figure out on my own, neither found any rationale in FAQ. Would be grateful for short explanation - thanks in advance.

Since early days when version 1.0 was released or before.

You can change it in your local ~/.profile file and/or other startup
resource files.

-- 
cyg Simple

--
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