X-Spam-Check-By: sourceware.org Message-ID: <43D78F0D.1030105@byu.net> Date: Wed, 25 Jan 2006 07:45:33 -0700 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 CC: cygwin mailing-list Subject: Re: Shell (bash, (pd)ksh, zsh, /not/ ash) + exec + here-doc + redirect == trouble! References: <43D78E29 DOT 4060504 AT byu DOT net> In-Reply-To: <43D78E29.4060504@byu.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 1/25/2006 7:41 AM: >>>=== begin testexec.sh === >>>#!/bin/ksh >>> >>>exec 5<&0 /bin/ksh <>>echo "First exec: Done." >>>exec 0<&5 >>>echo "Second exec: Done." >>>exit 0 >>>EOSH >>>==== end testexec.sh ==== > > > First line: This could be rewritten "exec /bin/ksh 5<&0 < way, you are replacing the current shell with an invocation of /bin/ksh, > and with fd 5 set to your current stdin, and then with fd 0 set to a pipe > supplied by the contents of the here-doc. P.S. If you had written this instead: exec /bin/ksh <