Fish Shell – Equivalent of Bash’s Process Substitution “<(command)"

fish

In bash, I usually do grep -f <(command) ... (I pick grep just for example) to mimic a file input.

What is the equivalent in fish shell? I cannot find it in the documentation.

Best Answer

The <() and >() constructs are known as "process substitution". I don't use fish, but according to its documentation, it doesn't directly support this:

Subshells, command substitution and process substitution are strongly related. fish only supports command substitution, the others can be achieved either using a block or the psub shellscript function.

Indeed, psub seems to be what you want:

## bash
$ seq 10 | grep -f <(seq 4 5)
4
5

## fish
~> seq 10 | grep -f (seq 4 5 | psub)
4
5