On Fri, Apr 22, 2016 at 12:34:48AM -0700, David Champion wrote:
> * On 21 Apr 2016, Jon LaBadie wrote: 
> > 
> > Unless it has changed recently, bash runs redirected read
> > commands in a sub-process.  Thus the variable fn would not
> > get set in the main process.
> 
> I haven't run into this (that I recall) with regular input redirection.
> It does happen with piped input redirection (to a read) because the
> pipeline terminal isn't the current shell.
> 
> yes:
> read fn </dev/tty
> 
> no:
> cat /dev/tty | read fn

Thanks for the correction David.
My negative bash experience was with pipes as in:

  date | read wday mon day time zone yr

which works fine in ksh and zsh.  I badly assumed
the limitation was to any redirection.

jl
-- 
Jon H. LaBadie                 j...@jgcomp.com
 11226 South Shore Rd.          (703) 787-0688 (H)
 Reston, VA  20190              (703) 935-6720 (C)

Reply via email to