zsh-users
 help / color / mirror / code / Atom feed
From: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>
To: zsh-users@sunsite.auc.dk
Subject: Re: variable containing the current command
Date: Wed, 26 May 1999 17:40:44 -0400	[thread overview]
Message-ID: <19990526174044.A7264@astaroth.nit.gwu.edu> (raw)
In-Reply-To: <19990526202314Z13566-3056+232@scapa.cs.ualberta.ca>

On Wed, May 26, 1999 at 02:23:10PM -0600, benjamin@cs.ualberta.ca 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@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


  reply	other threads:[~1999-05-26 21:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-26 20:23 benjamin
1999-05-26 21:40 ` Sweth Chandramouli [this message]
1999-05-26 22:17   ` Bart Schaefer
1999-05-26 22:50     ` Michael Barnes
1999-05-31  5:46       ` Bart Schaefer
1999-05-28 23:13     ` benjamin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990526174044.A7264@astaroth.nit.gwu.edu \
    --to=sweth@astaroth.nit.gwu.edu \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).