shell script - copy stdout to file
hello,
I have 2 scripts. at the script1 I have this line Code:
"..... cause I have at script2 line like this Code:
".... Code:
exec &> tmp5 Is there a way where I can copy the stdout to tmp5(that it will be both on stdout and tmp5) - its the best solution for me. |
I think the problem is that you still have tmp5 open for writing when you cat it. Maybe try
Code:
# 3 = old stdout, 4 = old stderr, stdout and stderr to tmp5 Code:
(.... Code:
(.... |
Can you plz explain me what does the parameters(and &) mean?
Should I put this line together? exec 1>&- 2>&- 1>&3- 2>&4-<tmp5 script3 or it whould be 2 lines? and what does it means <tmp5 script3 Thanks ! |
Quote:
Code:
{ Quote:
Code:
( exec >&-; echo -; ) > >(cat) |
Quote:
Quote:
Quote:
Quote:
Quote:
|
Quote:
Code:
{ :; A="Was in current shell."; } > >(:); echo "$A" Code:
{ :; A="Was in current shell."; } | tee >(:); echo "$A" |
Quote:
|
Now that's odd. With pipe you don't need to fork twice to create two processes on the background and share each other. Perhaps it's necessary to avoid errors or conflicts in other implementations of the shell.
Code:
I'm not sure if we are talking about the same "it"? Since we can't use pipes to maintain the code not running on a subshell we could just use process substitution twice: Code:
{ |
All times are GMT -5. The time now is 01:54 PM. |