3 ms·
BTW I've long wanted to do sth like this: Assume I have commands my_cat, my_grep, my_sort, my_send, and I want to use them in a pipe with_prefix my_ | cat fil
by ajuc 7y ago
BTW I've long wanted to do sth like this:
Assume I have commands my_cat, my_grep, my_sort, my_send, and I want to use them in a pipe
with_prefix my_ | cat file | grep phrase | sort | send | end_with | cat
The last cat would be the system one.
I don't think it's possible with bash?
- Crestwave 7y ago> I don't think it's possible with bash? No, pipes don't work like that. The closest I can think of is something like `(PATH=~/bin; cat file | grep phrase | sort | send) | cat`, where the custom commands don't have a prefix.
- supurbly 7y agoYou could have a file with functions binding, for example, `grep` to `my_grep`, then `source` that file in a subshell: ( source with_my_prefix.sh cat file | grep phrase | sort | send | end_with | cat )