Re: How to change command line prompt?

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: James Mcphee
Date:  
To: Main PLUG discussion list
Subject: Re: How to change command line prompt?
As an example to work with, here's mine.

RESET="\[\017\]"
NORMAL="\[\033[0m\]"
RED="\[\033[31;1m\]"
GREEN="\[\033[32;1m\]"
YELLOW="\[\033[33;1m\]"
BLUE="\[\033[34;1m\]"
WHITE="\[\033[37;1m\]"
SMILEY="${GREEN}:)${NORMAL}"
FROWNY="${RED}:(${NORMAL}"
SELECT="if [ \$? = 0 ]; then echo \"${SMILEY}\"; else echo \"${FROWNY}\";
fi"

# Throw it all together
PS1="${RESET}${GREEN}\u@\h${NORMAL} ${BLUE}\W \`${SELECT}\`
${GREEN}\$${NORMAL} "


What that does is give username@boxname in green. Directory in blue, and
then either a green smiley if your last command exited with code 0
(succeeded), or a red frowny if it exited with non-zero (didn't succeed).

I don't remember offhand where I nabbed it from, but I added it because I
was tired of always doing echo $? to see if some goofy command like
named-checkconf exited with nonzero.

On Mon, Jan 5, 2015 at 6:36 AM, Stephen Partington <>
wrote:

> That Cyberciti page is pretty detailed. I would suggest you go with it.
>
> On Fri, Jan 2, 2015 at 6:31 PM, Keith Smith <>
> wrote:
>
>>
>> I have been interested in this also. Found this site :
>> http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-
>> setup-prompt.html
>>
>>
>> On 2015-01-02 19:17, wrote:
>>
>>> I recently purchased a new Dell laptop, delete M$,
>>> installed Linux Mint, and I'm in the process of
>>> setting it up the way I want it.
>>>
>>> How can I change the command line prompt from the current:
>>>
>>> "joe@joe-dell-Inspiron-3542:>"
>>>
>>> to just: "joe:>"
>>>
>>> Also, I'd like to be able to turn the touchpad off and on
>>> but the only suggested method I have found to do this
>>> does not work for me: synclient TouchpadOff=1
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------
>>> PLUG-discuss mailing list -
>>> To subscribe, unsubscribe, or to change your mail settings:
>>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>>
>>
>> --
>> Keith Smith
>>
>> ---------------------------------------------------
>> PLUG-discuss mailing list -
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>
>
>
>
> --
> A mouse trap, placed on top of your alarm clock, will prevent you from
> rolling over and going back to sleep after you hit the snooze button.
>
> Stephen
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>




--
James McPhee

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss