Re: Custom prompt

From: craig(at)gtek(dot)biz
To: craig(at)gtek(dot)biz
Cc: "Adrian Klaver" <adrian(dot)klaver(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Custom prompt
Date: 2012-09-25 14:50:09
Message-ID: 1348584609.41445979@webmail.gtek.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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%](at)%/%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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2012-09-25 15:02:31 Re: plpython2u not getting any output -> on independent script I get the desired output
Previous Message Adrian Klaver 2012-09-25 14:47:46 Re: Running CREATE only on certain Postgres versions