Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: command substitution: zsh waits until command exits



On Nov 30,  5:31pm, Vincent Lefevre wrote:
} Subject: Re: command substitution: zsh waits until command exits
}
} > with "Command Substitution" listed as happening at the third step,
} > 
} >    ... in left-to-right fashion.
} 
} By "when zsh does the substitution", this includes the question
} whether zsh does the substitution before or after the command exits.
} For instance, zsh could start commands in the left-to-right fashion
} (I assumed asynchronously), but could replace the $(...) in some
} arbitrary order, once it knows the result, i.e. once the standard
} output is closed.

No, that would be non-deterministic with respect to left-to-right order.
Consider:

  echo $(echo first; exec >&- ; echo last > /tmp/first) $(</tmp/first)

If the commands were only started left-to-right and not also finished
left-to-right, $(</tmp/first) could fail with "no such file".

The default is to do everything synchronously.  That's why cases that
are asynchronous are explicitly called out, like process substitution.

} >   echo $(coproc xterm -e 'tty >&3; sleep 999999' 3>&1 ; read -E <&p)
} 
} OK, thanks. But is there any reason why Ctrl-C doesn't work in the
} xterm?

Could be any of a variety of reasons, the most likely of which is that no
interactive shell is being run.  Explicitly set the tty up the way you
want it by using X resources:

  XTerm*ttyModes: erase ^? intr ^C

Or

  xterm -xrm "*ttyModes: erase ^? intr ^C" -e 'tty >&3; sleep 999999' 3>&1



Messages sorted by: Reverse Date, Date, Thread, Author