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

Weird behavior with redirecting stdin



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 ...


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