Mail Archives: cygwin/2010/09/27/14:32:24
--------------000106080605080806060304
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 9/24/2010 5:15 AM, SJ Wright wrote:
> I'd like my terminal title bar to show my current working directory,
> the running process (with a fall-back to the active shell when idle)
> and the word "Cygwin."
>
> I have an old .bashrc file in which I collected code for the middle
> bit (running process), but putting the three together and making them
> work regardless of $TERM type is a challenge that's more than a little
> 'beyond my ken.' Nevertheless, as I think it would look great and be
> sufficiently informative at the same time, I'd like to pursue it.
>
> I haven't given up totally on rxvt: mintty has more than a few
> shortcomings imo, but I suspect a large part of that is that I'm not
> used to using an xterm variant outside of X or GNOME. Anyway, all of
> that is for another email.
>
> Where it meets at odd angles with this idea, is in that I suspect if I
> start with "tweaked" xterm settings that check out in rxvt, the
> strictly X syntax will work in mintty. In a sense, by going that
> route, I'll be 'ahead of the game' instead of 'trying to catch up.'
>
> Any help in this regard would be much appreciated.
See attachment. Invoke in your profile as:
. set_prompt.s
--------------000106080605080806060304
Content-Type: text/plain;
name="set_prompt.s"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment;
filename="set_prompt.s"
# This script must be sourced from the user's profile
# set_prompt.s: set the bash prompt
# By Vitek Gite and Lee Rothstein, 2008-05-22, 06:46 PM.
# Vitek supplied the article and the comments, here. Lee
# supplied the exact escape sequences to generate a prompt
# such as:
# [lr AT GW2] [/local/Scripts]
# 2010-01-08 Fri 02:32:17 PM
# $ xp
# in color.
# The notes (comments), below, are largely quoted from an article
# by Vitek Gite at the NixCraft forum:
# http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix
# Above article was still available as of 2010-01-08.
# My editor, TextPad, http://TextPad.com, allows urls and my
# browser to be accessed directly from text files. How about
# yours?
#PVersion="0.02.02.000"
#PUpDate="2010-02-15, 17:38:29"
#Textual Elements
#================
# * \a -- an ASCII bell character (07)
# * \d -- the date in "Weekday Month Date" format
# (e.g., "Tue May 26")
# * \D{format} -- the format is passed to strftime(3) and the
# result is inserted into the prompt string; an empty
# format results in a locale-specific time
# representation. The braces are required
# * \e -- an ASCII escape character (033)
# * \h -- the hostname up to the first '.'
# * \H -- the hostname
# * \j -- the number of jobs currently managed by the shell
# * \l -- the basename of the shell’s terminal device name
# * \n -- newline
# * \r -- carriage return
# * \s -- the name of the shell, the basename of $0 (the portion
# following the final slash)
# * \t -- the current time in 24-hour HH:MM:SS format
# * \T -- the current time in 12-hour HH:MM:SS format
# * \@ -- the current time in 12-hour AM/PM format
# * \A -- the current time in 24-hour HH:MM format
# * \u -- the username of the current user
# * \v -- the version of bash (e.g., 2.00)
# * \V -- the release of bash, version + patch level (e.g.,
# 2.00.0)
# * \w -- the current working directory, with $HOME abbreviated
# with a tilde
# * \W -- the basename of the current working directory, with
# $HOME abbreviated with a tilde
# * \! -- the history number of this command
# * \# -- the command number of this command
# * \$ -- if the effective UID is 0, a #, otherwise a $
# * \nnn -- the character corresponding to the octal number nnn
# * \\ -- a backslash
# * \[ -- begin a sequence of non-printing characters, which
# could be used to embed a terminal control sequence into
# the prompt
# * \] -- end a sequence of non-printing characters
#
# Colors
# ======
#
# To add colors to the shell prompt use the following export
# command syntax:
# '\e[x;ym $PS1 \e[m'
#
# Where,
# * \e[ Start color scheme
# * x;y Color pair to use (x;y)
# * $PS1 is your shell prompt
# * \e[m Stop color scheme
#
# To set a red color prompt, type the command:
#
# $ export PS1="\e[0;31m[\u@\h \W]\$ \e[m "
#
# Color Code
# Black 0;30
# Red 0;31
# Green 0;32
# Brown 0;33
# Blue 0;34
# Purple 0;35
# Cyan 0;36
#
# Replace lead digit 0 with 1, to get light color version.
#
# set on profile:
# export PS1="\e[0;31m[\u@\h \W]\$ \e[m"
#
# * Put \[ and \] around any color codes so that bash does not
# take them into account when calculating line wraps. Also you
# can make use of the 'tput' command to have this work in any
# terminal as long as the 'TERM' is set correctly. For instance
# '$(tput setaf 1)' and '$(tput sgr0)'
# LDR: Never able to get 'tput' to work, YMMV.
set -a # Export all variables
# All Work:
# Today’s date and hostname:
# $ PS1="\d \h $ "
# PS1="\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$(date '+%Y-%m-%d %a %r') \n$ "
# PS1="\[\e]0;\w\a\]\n\[\e[32m\][\u@\h] \[\e[33m\][\w]\[\e[0m\]\n\$(date '+%Y-%m-%d %a %r') \n$ "
# PS1="\[\e]0;\w\a\]\n\[\e[32m\][\u@\h] \[\e[36m\][\w]\[\e[0m\]\n\$(date '+%Y-%m-%d %a %r') \n$ "
# PS1="\[\e]0;\w\a\]\n\[\e[32m\][\u@\h] \[\e[36m\][\w]\[\e[0m\]\n\e[1;31m \$(date '+%Y-%m-%d %a %r')\n\e[m$ "
# Note: if you don't escape the '$' in the subexpression '\$(date...',
# it only computes the date/time at the time the prompt is
# set, NOT on each prompt generated
PS1="\[\e]0;\w\a\]\n\[\e[1;32m\][\u@\h] \[\e[1;36m\][\w]\[\e[0m\]\n\e[1;31m \$(date '+%Y-%m-%d, %H:%M:%S')\n\e[m$ "
# For debugging with bashdb:
PS4='(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]} - [${SHLVL},${BASH_SUBSHELL}, $?]'
--------------000106080605080806060304
Content-Type: text/plain; charset=us-ascii
--
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
--------------000106080605080806060304--
- Raw text -