feat: Process Substitution / pseudo-files
Author: con-f-useCreated May 15, 2019Updated Sep 25, 2026
Labelsparserthreadingpipesv1
In bash (and other shells), you can use the output of any command in a place where a file would normally be. The syntax is something like this:
grep foo <(echo -e "bla laber\nschwurbel foo bar parlens\nook")
# schwurbel foo bar parlensIs their an equivalent in xonsh? If not, there should be - a least with the bashism xontrib enabled.
I realize that I could use a pipe as in echo -e ... | grep ..., but there are programs that do not read from stdin, just from files.
Same is true with:
brace expansion:
bash -c 'echo {a,b{1..3},{f,g{h,j}}}{I,J}' aI aJ b1I b1J b2I b2J b3I b3J fI fJ ghI ghJ gjI gjJvariable expansion:
$ echo ${myvar:-default for myvar} default for myvar $ myvar=woohoo $ echo ${myvar:-default for myvar} woohoo
But I find myself missing these less and they might warrant separate issues.
For community
⬇️ Please click the reaction instead of leaving a +1 or comment
Source: xonsh/xonsh