This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Shell (bash, (pd)ksh, zsh, /not/ ash) + exec + here-doc + redirect == trouble!


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]