zsh-users
 help / color / mirror / code / Atom feed
* Weird behavior with redirecting stdin
@ 2019-09-02 13:58 Aryn Starr
  2019-09-02 14:00 ` Pier Paolo Grassi
  2019-09-02 14:36 ` Roman Perepelitsa
  0 siblings, 2 replies; 3+ messages in thread
From: Aryn Starr @ 2019-09-02 13:58 UTC (permalink / raw)
  To: zsh-users

With these functions:

```
fcm () {
# Function for selecting a command interactively
        echo ${(F)commands} | fzf
}

teec () {
# Dumbed down version of a function that both echoes and copies to clipboard. (Current toy version just echoes.)
        local out="$(</dev/stdin)"
        print -r -- "$out"
}
```

I can do `fcm | teec` and it works correctly.
However, if I change `teec` to this:

```
teec () {
        echo 'echo hi' | { eval "$(</dev/stdin)" }
        local out="$(</dev/stdin)"
        print -r -- "$out"
}
```

Then running `fcm | teec` hangs (after printing `hi`) and doesn’t even get interrupted with ^D or ^C.
I don’t understand why these problems occur at all, and I have no idea how to go about fixing them ...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-02 14:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 13:58 Weird behavior with redirecting stdin Aryn Starr
2019-09-02 14:00 ` Pier Paolo Grassi
2019-09-02 14:36 ` Roman Perepelitsa

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).