Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

reopening/resetting/tee'ing pipes?



% cat bar.sh     
#!/bin/zsh
echo 1
cat $1
echo 2
cat $1
echo 3
% ./bar.sh <(echo foo)
1
foo
2
3

is it possible to get another "foo" between 2 & 3 there given that i'm reading from a pipe? (both portable and zsh-only solutions are welcome)

essentially it feels like it ought to be possible to make bar.sh behave identically with a pipe and with a plain file

% echo foo>foo
% ./bar.sh foo
1
foo
2
foo
3
-- 
Aaron Davies
aaron.davies@xxxxxxxxx


Messages sorted by: Reverse Date, Date, Thread, Author