Tagged Questions
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:
...
0
votes
1answer
73 views
why there is random behaviuor for a background job?
going through advanced bash scripting guide example 3.3 running a loop in background, i found this :
#!/bin/bash
# background-loop.sh
for i in 1 2 3 4 5 6 7 8 9 10 # First loop.
do
echo -n "$i "
done ...
15
votes
3answers
1k views
How to do nothing forever in an elegant way?
I have a program which produces useful information on stdout but also reads from stdin. I want to redirect its standard output to a file without providing anything on standard input. So far, so good: ...
2
votes
2answers
586 views
Process not working when executed in background inside shell script
I have an application that runs fine, with and without '&' when run directly from the terminal. However, if I try to execute it from a shell script, it works only if the trailing '&' is ...