zsh-users
 help / color / mirror / code / Atom feed
* Redirecting variable fds
@ 1998-12-10 21:52 Phil Pennock
  1998-12-10 22:45 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Pennock @ 1998-12-10 21:52 UTC (permalink / raw)
  To: Zsh Users

Okay, I'm stumped.  I'm trying to write a function which has as one of
its arguments a file-descriptor, which should be redirected to another
arg.  My attempt is:
function bar {
	DEBUGMEM_INFOFD=$1 LD_PRELOAD=./bar.so $argv[3,-1] $1>$2
}
bar 5 test.out some-command and-an-arg

Unfortunately, somewhere in parsing, the ``$1>$2'' bit expands out to
become ``5 > test.out'' which adds an extra arg and redirects stdout.

By quick-hack was to just shove it onto the input buffer:
function bar {
	print -z DEBUGMEM_INFOFD=$1 LD_PRELOAD=./bar.so $argv[3,-1] "$1>$2"
}
and then press return.  This is not exactly optimal.  What am I doing
wrong?  Is there something I'm missing or is this the best solution?

Thanks,
-- 
--> Phil Pennock ; GAT d- s+:+ a22 C++(++++) UL++++/I+++/S+++/H+ P++@ L+++
E-@ W(+) N>++ o !K w--- O>+ M V !PS PE Y+ PGP+ t-- 5++ X+ R !tv b++>+++ DI+ D+
G+ e+ h* r y?


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-12-11  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-10 21:52 Redirecting variable fds Phil Pennock
1998-12-10 22:45 ` Stefan Monnier
1998-12-11  8:05   ` Phil Pennock

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).