Loading ...
Sorry, an error occurred while loading the content.
 

Re: Inverse and bold text in command line version

Expand Messages
  • Larr
    And here s a bit of fun for you too (sets your command prompt - best viewed on a Black Terminal background) PS1= n [ e[0;36m ] h [ e[1;37m ] ::
    Message 1 of 8 , Nov 15, 2012
      And here's a bit of fun for you too (sets your command prompt - best viewed on a Black Terminal background)

      PS1='\n\[\e[0;36m\]\h \[\e[1;37m\] :: ${PWD}\n\u\[\e[1;34m\]`r=$?; test $r -ne 0 && echo " \[\e[1;31m\]ret:$r"`\[\e[m\] > '; export PS1

      Here's what it does:
      \n (CRLF)
      <esc>[0;36m sets the color of the text to a shade of blue
      \h (Hostname)
      <esc>[1;37m sets color of text to bold white
      :: (just two colons)
      ${PWD} is the common working directory. You can also use \w but I like to see the full path and not things like "~" for $HOME
      \n (CRLF)
      \n (Username)
      The code between the `r= ... ]ret:$r` does is check $? for 0. If non-zero display it in bold-red

      Check out this web site for a good list of color code:

      http://www.pixelbeat.org/docs/terminal_colours/

      --- In chipmunkbasicforum@yahoogroups.com, marionbarryuk <no_reply@...> wrote:
      >
      > I'd like to use bold and inverse text in an OS X command line app I am working on, but I have not been able to find the control code to do as such.
      >
      > Any hints?
      >
      > Thanks!
      >
      > Pete
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.