ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  bash on Mac OS X
Subject:   if only ...
Date:   2004-02-25 08:54:46
From:   blalor
Response to: if only ...

But you can!


if [ "${TERM#xterm}" != "${TERM}" ] && [ "${EMACS}" != "t" ]; then
# Set prompt to "[$USER@$HOSTNAME `pwd` ]> "
prompt_command () {
# Display my current machine and directory in the title bar!
title="${LOGNAME}@$(hostname -s):[$(dirs)]"
echo -n "ESC]1;$title^G"
echo -n "ESC]2;$title^G"
}


export PROMPT_COMMAND=prompt_command
else
unset PROMPT_COMMAND
fi


(the ESC and ^G are actually control characters I entered in with Emacs; \033 and \007 would probably work, too.)
That gives you a prompt like [blalor@Animal ~]> and a window title like blalor@Animal:[~]


1 to 2 of 2
  1. if only ...
    2004-02-28 04:29:31  hysterion [View]

  2. if only ...
    2004-02-27 04:04:25  henksmets [View]

1 to 2 of 2