delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/25/00:12:02

X-Spam-Check-By: sourceware.org
Message-ID: <n2m-g.dr7491.3vv7b8v.1@buzzy-box.bavag>
From: Bas van Gompel <cygwin DOT buzz AT bavag DOT tmfweb DOT nl>
Subject: Shell (bash, (pd)ksh, zsh, /not/ ash) + exec + here-doc + redirect == trouble!
Reply-To: cygwin mailing-list <cygwin AT cygwin DOT com>
Organisation: Ehm...
User-Agent: slrn/0.9.8.1 (Win32) Hamster/2.1.0.0 KorrNews/4.2.1
To: cygwin AT cygwin DOT com
Lines: 53
Date: Wed, 25 Jan 2006 06:11:47 +0100 (MET)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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

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/

- Raw text -


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