bash: shell function - redirect standard out and error to a log file



  • Take into account the main readme for this section. README first.

    Redirection standard error and standard output to a logfile.

    function my_status {
      w|head -1
    } 2>&1 > /tmp/logfile
    
    my_status
    echo "Check your log file"
    

Log in to reply
 

© Lightnetics 2024