Timeline for Bash: How to get stdout to console and also pipe to next command?
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 26, 2020 at 15:36 | vote | accept | alchemy | ||
| Mar 26, 2020 at 3:10 | comment | added | alchemy | This is great, exactly what I was looking for! @mosvy, there may be special cases where it doesnt work, and good to know it will translate into a script. What is 7 again? | |
| Mar 25, 2020 at 20:34 | comment | added | user313992 |
You can do that even when not run from a terminal { echo "Hello word" | tee /dev/fd/7 | wc -c; } 7>&1 (ok, not POSIX, and will NOT work on FreeBSD by default). Notice that /dev/tty or /dev/pts/N do not always work: su other_user -c 'echo hi | tee /dev/tty | wc -c' => tee: /dev/tty: No such device or address. But it's not clear for me that it's this that the OP is after ;-)
|
|
| Mar 25, 2020 at 19:02 | history | answered | Kamil Maciorowski | CC BY-SA 4.0 |