This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does default shell prompt PS1 contain newlines (\n)?



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]