Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jonasbn (1153)

jonasbn
  reversethis-{gro.napc} {ta} {nbsanoj}
http://e-diot.dk/
AOL IM: BJonasN (Add Buddy, Send Message)

Perl Programmer located in Copenhagen, Denmark. Active member of Copenhagen Perl Mongers.

Author of:

  • Business::DK::CPR
  • Business::DK::CVR
  • Business::DK::PO
  • Business::OnlinePayment::CashCow
  • Date::Holidays
  • Date::Holidays::Abstract
  • Date::Holidays::Super
  • Date::Pregnancy
  • Games::Bingo
  • Games::Bingo::Bot
  • Games::Bingo::Print
  • Module::Info::File
  • Module::Template::Setup
  • Test::Timer

and maintainer of:

  • Tie::Tools
  • XML::Conf
  • Workflow

Journal of jonasbn (1153)

Friday October 17, 2008
01:51 AM

Promptly

[ #37683 ]

I have for a long time used the following prompt in my bash shell:

S1="\h \w\n\r% "


hoarfrost /Users/jonasbn
%

I do however sometimes resort to wanting to copy a path and command to another terminal, where I would just write cd

The % would however give the following error message when pasted:


-bash: fg: %: no such job

So I changed it to:

PS1="\h \w\n\r; "

Warning gone, I could remove the hostname to make it easier to copy it.

PS1="\h\n\w\n\r; "

Suggestions welcome:

In addition to the bash prompt, I find the following to prompt useful:

For MySQL:

MYSQL_PS1="(\u@\h) [\d]> "

For PostgreSQL (from .psqlrc)

\set PROMPT1 '(%n@%m) [%/]>'

These show the user, hostname and database. Having the two database engine prompt being uniform, is quite nice.

I found the following tip however, which includes transactional state in the prompt. This could prove quite useful.

prompt suggestions and examples welcome

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I use '#' (comment marker) at the beginning of the 2-line prompt (when using X; space is at premium on console). That way even if you copy the whole thing, one can still edit the lines before executing. (BTW, vi-mode in zsh is really excellent, much better than ksh93 or bash3.)

    --
    - parv
  • \n\[\033[45m\]\u@\h${debian_chroot:+ \[\033[0m\]($debian_chroot)\[\033[45m\]}: \[\033[49m\]\[\033[31m\]\w\n\[\033[0m\]\[\033[45m\]#\[\033[0m\]\t \[\033[45m\]$\[\033[0m\]

  • I use color on my .psqlrc on production machines, in particular, the red color, to remember to think twice before "TRUNCATE"-ing tables or deleting stuff... :-)

    \timing
    \set PROMPT1 '%[%033[1;31;40m%]%n::%/@%`hostname -s` %x%R%[%033[0m\n%#%]'
    \set PROMPT2 '... %#%] '