You are not logged in.

#1 2009-08-27 18:24:12

playdafunkimuzic
Member
Registered: 2008-10-25
Posts: 220

[Solved] Change bash prompt listing in terminal

Hi,

I've always used c-shell for ease in writing shell scripts. I'm interested in moving to bash and just using c-shell for scripting.

In a .cshrc I can do something like this:

if [ -o /bin/su ]; then
        set prompt="%{\e]2\;%t - %m:%/^g\e]1\;%m^g\r%}%B:%m%b# "
else
    set prompt="%{\e]2\;%t - %m:%/^g\e]1\;%m^g\r%}%B:%m%b$ "
fi

I edited the if statement for what an if statement should look like in bash. This, however, doesn't work. I'm assuming the word "prompt" is wrong. How do I get this working in bash?

EDIT: SEEMS LIKE THIS DID IT!

PS1="\u@\h:\w#

Last edited by playdafunkimuzic (2009-08-27 18:29:51)

Offline

#2 2009-08-27 18:33:51

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [Solved] Change bash prompt listing in terminal

export PS1="whatever" is the way to set the prompt in bash.  not sure bout that -o are you checking for root? if so, [ $(id -u) -iq 0 ] returns true for root.

Offline

Board footer

Powered by FluxBB