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!


[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/


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