delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/25/09:44:13

X-Spam-Check-By: sourceware.org
Date: Wed, 25 Jan 2006 09:43:54 -0500 (EST)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: Shell (bash, (pd)ksh, zsh, /not/ ash) + exec + here-doc +redirect == trouble!
In-Reply-To: <n2m-g.dr7491.3vv7b8v.1@buzzy-box.bavag>
Message-ID: <Pine.GSO.4.63.0601250938100.2078@access1.cims.nyu.edu>
References: <n2m-g DOT dr7491 DOT 3vv7b8v DOT 1 AT buzzy-box DOT bavag>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

> 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 ====

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

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

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
Linux.

> Are all these shells borrowing code from each other?

Most definitely not.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
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:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019