Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Redirecting variable fds



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?



Messages sorted by: Reverse Date, Date, Thread, Author