This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Shell (bash, (pd)ksh, zsh, /not/ ash) + exec + here-doc + redirect == trouble!
- From: Bas van Gompel <cygwin dot buzz at bavag dot tmfweb dot nl>
- To: cygwin at cygwin dot com
- Date: Wed, 25 Jan 2006 06:11:47 +0100 (MET)
- Subject: Shell (bash, (pd)ksh, zsh, /not/ ash) + exec + here-doc + redirect == trouble!
- Organisation: Ehm...
- Reply-to: cygwin mailing-list <cygwin at cygwin dot com>
Hi,
Try the following script:
=== begin testexec.sh ===
#!/bin/ksh
exec 5<&0 /bin/ksh <<EOSH
echo "First exec: Done."
exec 0<&5
echo "Second exec: Done."
exit 0
EOSH
==== end testexec.sh ====
(Replace ksh with bash or zsh at will, above.)
For me, this prints ``First exec: Done.'', then leaves me to type
shell-commands, _which are executed_, until I press EOF (^D).
In ash it prints ''
First exec: Done.
Second exec: Done.
'', as I expected. Compare p.e.
=== begin testexec2.sh ===
#!/bin/bash
echo 'echo "First exec: Done."
exec 0<&5
echo "Second exec: Done."
exit 0' |exec 5<&0 /bin/bash
==== end testexec2.sh ====
, which also performs as expected.
Has anybody got a clue?
Is this cygwin-specific?
Are all these shells borrowing code from eachother?
L8r,
Buzz.
--
) | | ---/ ---/ Yes, this | This message consists of true | I do not
-- | | / / really is | and false bits entirely. | mail for
) | | / / a 72 by 4 +-------------------------------+ any1 but
-- \--| /--- /--- .sigfile. | |perl -pe "s.u(z)\1.as." | me. 4^re
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/