On Sat, Jan 11, 2003 at 07:39:33PM -0500, Werner Puschitz wrote:
> > Just curious. Because if I make my hostname able.george.smth   I am sure 
> > the prompt will have it shortened up to just 'able'??
> > 
> > Maybe I am wrong but it seems that this is what happened to me before..
> 
> It's shortened because 'hostname' is executed in /etc/profile:
> HOSTNAME=`/bin/hostname`

/bin/hostname shows the fully qualified name on machines
configured with a fully qualified name.

        [jft@zx750 jft]$ /bin/hostname
        zx750.tadlocks.net

So in /etc/profile the line:

HOSTNAME=`/bin/hostname`

is actually setting the HOSTNAME variable to the fully qualified
name.

The way the default bash prompt looks is determined from
/etc/bashrc , note this line:

PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'

The part in we are concerned with is ${HOSTNAME%%.*}

This takes the HOSTNAME variable (set in /etc/profile) and then
drops everything after the first '.'.

Example:

        [jft@zx750 jft]$ echo ${HOSTNAME%%.*}
        zx750

and this is what you see in the bash prompt.

Hope this helps.

/jft



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to