Tagged Questions
1
vote
1answer
57 views
How to open process substituted file from php?
Here's what I tried to do myself:
$ type 1.sh
#!/bin/bash -eu
php -r 'var_dump(file_get_contents($_SERVER["argv"][1]));' -- <(echo 1)
$ ./1.sh
PHP Warning: file_get_contents(/dev/fd/63): failed ...
5
votes
2answers
65 views
Combining multiple process substitution
Suppose you tried something like this:
$ paste ../data/file-{A,B,C}.dat
and realize that you want to sort each file (numerically, let's suppose) before pasting. Then, using process substitution, ...
2
votes
1answer
106 views
How to wait for a subprocess used for I/O redirection?
Consider the following snippet of Bash script:
exec 3> >(sleep 1; echo "$BASHPID: here")
do-something-interesting
exec 3>&-
wait $!
echo "$BASHPID: there"
When executed, it produces:
...
3
votes
2answers
476 views
How do I use tee to redirect to grep
I don't have much experience of using tee, so I hope this is not very basic.
After viewing one of the answers to this question I came across a strange beheviour with tee.
In order for me to output ...
4
votes
1answer
219 views
Pipes vs process substitution
While trying the cat "$@" trick to read from either standard input or given files, it turned out that pipe and process substitution handle a missing trailing newline differently:
printf %s foo > ...
3
votes
4answers
402 views
Bash Reuse Process Substitution File
I have a big script which takes a file as input and does various stuff with it. Here is a test version:
echo "cat: $1"
cat $1
echo "grep: $1"
grep hello $1
echo "sed: $1"
sed 's/hello/world/g' $1
I ...
