Browse Source

fragment for reading stdin in a shell function

Brennen Bearnes 6 months ago
parent
commit
8eef89f31d
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      home/fragments/func-stdin.sh

+ 9
- 0
home/fragments/func-stdin.sh View File

@@ -0,0 +1,9 @@
1
+#!/bin/sh
2
+
3
+myread () {
4
+  while read foo; do
5
+    echo "$foo";
6
+  done
7
+}
8
+
9
+cat /etc/motd | myread

Loading…
Cancel
Save