Difference between revisions of "Standard input (/dev/stdin)"

From wikieduonline
Jump to navigation Jump to search
Line 11: Line 11:
 
  #!/bin/bash -
 
  #!/bin/bash -
 
   
 
   
  exec > >(tee "$HOME/somefile.log") 2>&1
+
  exec > >([[tee]] "$HOME/somefile.log") [[2]]>[[&1]]
 
   
 
   
 
  echo "$HOME"
 
  echo "$HOME"
 
  echo hi
 
  echo hi
  date
+
  command_that_pipes_output_to_stderr_but_will_be_redirected_to_stdout
date +%F
 
 
  echo bye 1>&2
 
  echo bye 1>&2
  

Revision as of 07:35, 3 November 2022

This article is a Draft. Help us to complete it.

wikipedia:stdin

  • 2>&1
  • &>


https://unix.stackexchange.com/questions/61931/redirect-all-subsequent-commands-stderr-using-exec
#!/bin/bash -

exec > >(tee "$HOME/somefile.log") 2>&1

echo "$HOME"
echo hi
command_that_pipes_output_to_stderr_but_will_be_redirected_to_stdout
echo bye 1>&2

Activities

Related terms

See also

Advertising: