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]

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

On Wed, 25 Jan 2006, Bas van Gompel wrote:

> Hi,
> Try the following script:
> === begin ===
> #!/bin/ksh
> exec 5<&0 /bin/ksh <<EOSH
> echo "First exec: Done."
> exec 0<&5
> echo "Second exec: Done."
> exit 0
> ==== end ====

You might want to quote <<'EOSH', but that's not the cause of your
problem.  Here's a funny thing:

exec 5<&0 /bin/bash <<'EOSH'
echo "First exec: Done."
exec 0<&5
echo "Second exec: Done."
exit 0

works for me.  Don't ask me why, though.  Perhaps Eric will chime in.

> Has anybody got a clue?
> Is this cygwin-specific?

That's easy to check.  It isn't.  I get the same behavior with bash-3.0 on

> Are all these shells borrowing code from each other?

Most definitely not.
      |\      _,,,---,,_ |
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

Unsubscribe info:
Problem reports:

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