Created
May 31, 2019 20:32
-
-
Save brennen/9bbb94976a4e8fd1d1b126c73e4929aa to your computer and use it in GitHub Desktop.
read stdin in a shell function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brennen@inertia 14:31:49 ~/fragments (master m2/u4) ▣ cat func-stdin.sh | |
#!/bin/sh | |
myread () { | |
while read foo; do | |
echo "$foo"; | |
done | |
} | |
cat /etc/motd | myread | |
brennen@inertia 14:31:52 ~/fragments (master m2/u4) ▣ ./func-stdin.sh | |
The programs included with the Debian GNU/Linux system are free software; | |
the exact distribution terms for each program are described in the | |
individual files in /usr/share/doc/*/copyright. | |
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | |
permitted by applicable law. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment