Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: prefix all commands?
- X-seq: zsh-users 12085
- From: Chris Johnson <cjohnson@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: prefix all commands?
- Date: Tue, 23 Oct 2007 09:12:57 -0400
- In-reply-to: <200710221819.56163.river@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200710221819.56163.river@xxxxxxxxxxxxx>
River Tarnell sent me the following 0.8K:
> i would like to write a script which can prefix all commands with "pfexec ".
> for example, if the user runs "ls", the shell should actually run "pfexec
> ls". similarly, "a | grep b" should become "pfexec a | pfexec grep b".
>
> is there any way to do this?
I do something like this to interactively sandwich a command to run it
in gdb:
run-in-gdb() {
# This function is ZLE widget that runs the current command in gdb.
# It commits the current, unaltered command line to history, insets
# its words in a gdb command, and runs it.
print -s ${(z)BUFFER}
BUFFER="gdb -x =(print run) --args $BUFFER"
zle accept-line
}
zle -N run-in-gdb
bindkey "^X^G" run-in-gdb
I just type the command normally, hit <Control-X><Control-G>, and gdb
takes the program and runs it. You could do something similar but
insert pfexec instead. But perhaps you're looking for something more
pervasive?
--
Chris Johnson
cjohnson@xxxxxxxxxx
http://www.cs.utk.edu/~cjohnson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author