Shell Prompt Customization

Posted:
in macOS edited January 2014
I've just changed my shell to Bash, and I'm getting my shell prompt back to the way that I like it, and I thought that it would be interesting to see how some other *nix-heads have their prompt customized.



Here's how mine looks, except I have the window set to an off white/light yellow color, with only slight transparency:

[05:47 matthew:/usr/local/bin]$



FWIW, here's the code to do this in bash:

Code:


export PS1="\\[\\e[36;31m\\][\\A \\u\[\\e[36;34m\\]\\w\\[\\e[36;31m\\]]\\$ \\[\\e[36;0m\\]\\[\\e]2;\\h\w\\a\\]"







That last bit sets the titlebar of the terminal window to the hostname:current working directory.



Fun stuff like this can be done to the tcsh shell that is the default in OS X. If anyone wants to know how to set this up in tcsh, just let me know, and I can guide you through it really easily.



Edit: Isn't the [code] tag supposed to prevent smilies from showing up?

Comments

  • Reply 1 of 7
    1337_5l4xx0r1337_5l4xx0r Posts: 1,558member
    Hey, thanks for that last bit. i was wondering how to set the titlebar.



    Mine's boring:

    Code:


    PS1='\\u@\\h\w]\\[\\e[36;0m\\]\\[\\e]2;\\h\w\\a\\]'





  • Reply 2 of 7
    scottscott Posts: 7,431member
    What's the purpose of the "code" tag if it's going to put the smiles in
  • Reply 3 of 7
    *ahem*



  • Reply 4 of 7
    1337_5l4xx0r1337_5l4xx0r Posts: 1,558member
    That doesn't answer Scott's question, but thanks nonetheless!



  • Reply 5 of 7
    The purpose of the code tag is for posting programming source code, ASCII art, or something else which would require a monospaced, non-proportional font. If you want to toggle off smilies, there is a separate function (as I pointed out) for that.
  • Reply 6 of 7
    baumanbauman Posts: 1,248member
    Yeah, except who wants smilies in code? Couldn't you set vB to not parse smilies when it's in a [code] tag? Oh, and speaking of parsing when you don't want it to, I hate it when you do something like www.geocities.com/pannypunk11/rant_02.html+%22ranting+about+ranting%22&hl=en&ie= UTF-8]Google's cache of rant link[/URL], and vB also parses the www.geocities.com that is within the google URL. It should look like this: Google's cache of rant link. GRRR



    Back on topic, I kinda wonder how many others on AI have customized their prompt.... I knew I could count on you, 1337, but I know there are other shell users out there...
  • Reply 7 of 7
    torifiletorifile Posts: 4,024member
    Quote:

    Originally posted by bauman





    Back on topic, I kinda wonder how many others on AI have customized their prompt.... I knew I could count on you, 1337, but I know there are other shell users out there...




    I haven't, but I'd like to. Hell, I'm still using tcsh eventhough everyone says bash is better. Just haven't got the time to do the change. :/
Sign In or Register to comment.