Difference between revisions of "Exec"

From wikieduonline
Jump to navigation Jump to search
Line 10: Line 10:
  
 
https://unix.stackexchange.com/questions/61931/redirect-all-subsequent-commands-stderr-using-exec
 
https://unix.stackexchange.com/questions/61931/redirect-all-subsequent-commands-stderr-using-exec
<pre>
 
#!/bin/bash -
 
  
exec > >(tee "$HOME/somefile.log") 2>&1
+
[[#!/bin/bash]] -
 
+
echo "$HOME"
+
exec > >(tee "$HOME/somefile.log") 2>&1
echo hi
+
date
+
echo "$HOME"
date +%F
+
echo hi
echo bye 1>&2
+
date
</pre>
+
date +%F
 +
echo bye 1>&2
  
 
== Related commands ==
 
== Related commands ==

Revision as of 11:40, 2 February 2023

Advertising: