Re: Custom prompt - Mailing list pgsql-general

From craig@gtek.biz
Subject Re: Custom prompt
Date
Msg-id 1348584609.41445979@webmail.gtek.biz
Whole thread Raw
In response to Re: Custom prompt  (craig@gtek.biz)
List pgsql-general

> Aha, exactly what I was looking for. Thanks!

  Well I certainly feel dumb. The answer is right in the documentation, I just
failed to find it (I did look first). The system-wide psqlrc, and the ~/.psqlrc
files fit the bill perfectly, and the documentation explains it all quite
nicely. I accomplished my main goal better than I had even hoped. Our two
production servers are locked down and do not accept external connections. I
wanted to customize the prompt so I could tell at a glance which I was on. The
documentation even explains how to have a tcsh-like color prompt, which I use
quite extensively in bash. I now have a yellow prompt on one server, and a red
one on the other. How cool is that!

my system-wide psqlrc (/etc/sysconfig/pgsql/psqlrc on CentOS):

\set PROMPT1 %[%033[1;31;40m%]%n%[%033[0m%]@%/%R%# >

This puts the username in red, followed by @DBNAME in white, both on a black
background. I'll probably tweak this as I go, but this works for now.

Thanks to all for the help!




Sent - Gtek Web Mail

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Running CREATE only on certain Postgres versions
Next
From: Adrian Klaver
Date:
Subject: Re: plpython2u not getting any output -> on independent script I get the desired output