[X-Unix] Changing the default shell

Joe Block jpb at ApesSeekingKnowledge.net
Wed Jul 14 11:42:03 PDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Jul 14, 2004, at 1:35 AM, Bert Knabe wrote:

>
> On Jul 14, 2004, at 12:15 AM, James Bucanek wrote:
>
> *snip*
>
>>> I've changed the default shell to bash, which is good. But I thought
>>> that doing that instead of using the 'temporary' method of having
>>> execute a command (in this case /bin/bash/) using the Terminal
>>> Preferences would have bash showing the path to your location in the
>>> hierarchy the way tcsh does. How would I tell it to do that?
>>
>> It should do it by default, unless your bash configuration has been 
>> altered.
>>
>> Here's the default bashrc file that's installed in Panther:
>>
>>     james% cat /etc/bashrc
>>     # System-wide .bashrc file for interactive bash(1) shells.
>>     PS1='\h:\w \u\$ '
>>     # Make bash check it's window size after a process completes
>>     shopt -s checkwinsize
>>
>> This should set PS1 (which is the main shell prompt) to '\h:\w \u\$ 
>> '.  That should display the following prompt
>>
>>     <machine_name>:<pwd> <whoami>$
>>
>> If PS1 isn't that string, then something else is changing it (or you 
>> don't have read access to /etc/bashrc).

Add this to ~/.bashrc or ~/.bash_profile

- -- cut --
PS1='[\u@\h:\w]\$ '

# the \[ and \] surrounding the prompt tell bash to count the escaped 
characters
# properly
export TITLEBAR='\[\033]0;\u@\h:\w \007\]'

# Terminal sets TERM_PROGRAM so we can tell it apart from regular VT100
case "$TERM_PROGRAM" in
         "Apple_Terminal")PS1="$TITLEBAR$PS1"
esac

# xterm windows set TERM
case "$TERM" in
         
"xterm"|"vt100"|"color-xterm"|"xterm-color")PS1="$TITLEBAR$PSRAW"
esac

export PS1
- -- cut --

This will set your environment so that your username, what host the 
window is connected to, and the current directory are shown in the 
title bar of the Terminal window, in addition to at the command prompt. 
If you run X Window, xterms & color xterms will also show the 
information in the title bar.

jpb
- -- 
Joe Block <jpb at ApesSeekingKnowledge.net>

Human beings will generally exercise power when they can get it, and 
they will exercise it most undoubtedly in popular governments under 
pretense of public safety.
  - Daniel Webster
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFA9X58yEXo8W2M9hsRAr0IAJ9pNtp1Leea0RrMgynAoG51m+AkmACgsBkD
dj+yO+Npvx5/yKfOaxHv8Jc=
=d0mf
-----END PGP SIGNATURE-----



More information about the X-Unix mailing list