Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: command substitution: zsh waits until command exits
- X-seq: zsh-users 12282
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: command substitution: zsh waits until command exits
- Date: Mon, 03 Dec 2007 19:25:54 -0800
- In-reply-to: <20071204020325.GF5855@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <071130073719.ZM18090@xxxxxxxxxxxxxxxxxxxxxx> <20071130163155.GL5855@xxxxxxxxxxxxxxxxxxx> <071130185827.ZM18402@xxxxxxxxxxxxxxxxxxxxxx> <20071202021652.GO5855@xxxxxxxxxxxxxxxxxxx> <071201210744.ZM20044@xxxxxxxxxxxxxxxxxxxxxx> <20071202152254.GP5855@xxxxxxxxxxxxxxxxxxx> <071202102717.ZM2757@xxxxxxxxxxxxxxxxxxxxxx> <20071203011131.GT5855@xxxxxxxxxxxxxxxxxxx> <20071203170225.GD5855@xxxxxxxxxxxxxxxxxxx> <071203104107.ZM4640@xxxxxxxxxxxxxxxxxxxxxx> <20071204020325.GF5855@xxxxxxxxxxxxxxxxxxx>
On Dec 4, 3:03am, Vincent Lefevre wrote:
} Subject: Re: command substitution: zsh waits until command exits
}
} > } #!/usr/bin/env zsh
} > }
} > } echo foo | tee \
} > } $({ xterm -e 'zsh -fic "tty >&3 ; exec sleep 99999999"' 3>&1 & } | read -E)
} > }
} > } and run it, then lots of xterms are started recursively!
} >
} > What did you name the script? I can't reproduce this.
}
} I've found the problem: this comes from the line
}
} SHELL=${0#-}
}
} I have in my ".zshenv". Somewhere .zshenv is sourced with $0 having
} the name of the script. Is there any reason?
I suspect that first
#!/usr/bin/env zsh
starts a shell which doesn't have -f and therefore reads .zshenv and
sets SHELL to the name of the script, and *then* xterm starts $SHELL
to intepret its -e option. The problem with using "env" in that way
is that you can't provide any options to the command.
Try it this way, where the -e option is not a quoted string:
------------------
#!/usr/bin/env zsh
echo foo | tee \
$({ xterm -e zsh -fic "tty >&3 ; exec sleep 99999999" 3>&1 & } | read -E)
------------------
If that doesn't work, explicitly reset SHELL:
------------------
#!/usr/bin/env zsh
SHELL=$(/usr/bin/env zsh)
echo foo | tee \
$({ xterm -e 'zsh -fic "tty >&3 ; exec sleep 99999999"' 3>&1 & } | read -E)
------------------
Messages sorted by:
Reverse Date,
Date,
Thread,
Author