Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: variable containing the current command
- X-seq: zsh-users 2345
- From: Sweth Chandramouli <sweth@xxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Re: variable containing the current command
- Date: Wed, 26 May 1999 17:40:44 -0400
- In-reply-to: <19990526202314Z13566-3056+232@xxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <19990526202314Z13566-3056+232@xxxxxxxxxxxxxxxxxxxx>
On Wed, May 26, 1999 at 02:23:10PM -0600, benjamin@xxxxxxxxxxxxxx wrote:
> Is there a zsh environment variable that contains the current command
> so that it can be referenced in preexec() or precmd() (or ideally both)?
>
> e.g.
>
> precmd() { echo "Just did:$CURRENT_CMD" }
> preexec() { echo "Ready to do:$CURRENT_CMD" }
>
> localhost[1]% ls
> Ready to do:ls
> foo bar snafu tarfu
> Just did:ls
> localhost[2]%
$_ is almost what you are looking for; it is supposed to be set for
any command to the full name of that command. if you use it as you use
CURRENT_CMD above, however, you get something like this:
(astaroth/1)~: precmd() { echo "Just did:$_" }
Just did:precmd
(astaroth/2)~: preexec() { echo "Ready to do:$_" }
Just did:preexec
(astaroth/3)~: ls
Ready to do:preexec
appconfig Mail News public_html working
bin mail news src www
docs misc nohup.out tmp
Just did:ls
(astaroth/4)~:
i could never figure out why it acts that way, though, so i've
never really used it.
-- sweth.
--
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@xxxxxxx> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author