delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/26/22:09:03

X-Spam-Check-By: sourceware.org
Message-ID: <n2m-g.drc625.3vva5g7.1@buzzy-box.bavag>
From: "Buzz" <cygwin DOT buzz AT bavag DOT tmfweb DOT nl>
Subject: Re: Shell (bash, (pd)ksh, zsh, /not/ ash) + exec + here-doc + redirect == trouble!
References: <012520062028 DOT 10525 DOT 43D7DF6F0008E6E60000291D22007507840A050E040D0C079D0A AT comcast DOT net>
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
In-Reply-To: <012520062028.10525.43D7DF6F0008E6E60000291D22007507840A050E040D0C079D0A@comcast.net>
Lines: 42
Date: Fri, 27 Jan 2006 04:08:47 +0100 (MET)
X-IsSubscribed: yes
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

[No need to Cc me.]

Op Wed, 25 Jan 2006 20:28:32 +0000 schreef Eric Blake
in <012520062028.10525.43D7DF6F0008E6E60000291D22007507840A050E040D0C079D0A<at>comcast.net>:

[Adding attrib to self:]
: Buzz:
: > I (now) understand what's happening. I think it's undesirable, though.
:
:  That's a relative viewpoint.  Personally, I like the fact that
:  the rules are consistent (process instructions one line at
:  a time; and apply pipelines first, then apply all redirections,
:  including here-docs, in left-to-right order), and that the
:  rules allow you to save stdin without having it be fd 0

Sure, but to have the shell redirect /it's own/ input instead of the
input of it's sub-commands is counter-intuitive _and_ counter-
productive IMO. I like to write things like:

  exec sh 5<&0 <<EOSH
  exec 0<&5
  vim "$0"
  echo -n 'Edit OK? (yes/gigo)'
  read a
  if test "\$a" = yes ; then
    "$0" "$@"
  fi
  exit 0
  EOSH

which is fine if sh == ash...

...but this is OT. I'll try find a more appropriate forum.


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