[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to run something before invoking the inputted command?
From: |
Clark J. Wang |
Subject: |
Re: How to run something before invoking the inputted command? |
Date: |
Tue, 13 Jul 2010 22:26:57 +0800 |
On Tue, Jul 13, 2010 at 8:22 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Tue, Jul 13, 2010 at 11:19:34AM +0800, Clark J. Wang wrote:
> > My PS1 depends much on PROMPT_COMMAND. For example, my PROMPT_COMMAND
> will
> > trim very long $PWD to a shorter one (depends on the window size of
> current
> > terminal):
> >
> > [root@server ~/directory/loooooooong/very/a/is/this] # ---->
> > [root@server ~/.../very/a/is/this] #
>
> The same thing could be done with a command substitution inside PS1.
>
Agree. Actually my PROMPT_COMMAND does more than that, it'll also update a
few more vars. Too many command substitution in PS1 may affect the
performance, I think.
-Clark
Re: How to run something before invoking the inputted command?, Andreas Schwab, 2010/07/12