I have an input stream, and I want to “map” to output lines. For instance, if my input stream were the files nums, I’d want that this syntax
$ cat nums
9534
2343
1093
7023
$ cat nums | map ./myscript $0
would be equivalent to
$ echo 9534 | ./myscript
$ echo 2343 | ./myscript
$ echo 1093 | ./myscript
$ echo 7023 | ./myscript
I think
xargsis the closest thing to your hypotheticalmap:or
or
Unfortunately,
xargsdoesn’t let you invoke things that read from stdin, so you’d have to rewrite your script to accept a command-line argument rather than reading from stdin.