Bash scripting, checking for errors, logging

后端 未结 4 1065
萌比男神i
萌比男神i 2021-02-03 13:43

Here\'s one for the bash-fu wizards. No, actually, I\'m just kidding, you\'ll all probably know this except for me..

I\'m trying to create a backup shell script. The ide

4条回答
  •  悲哀的现实
    2021-02-03 14:13

    For logging, you can wrap sections of your script in curly braces and redirect the stdout to a log file:

    {
        script_command_1
        script_command_2
        script_command_3
    } >> /path/to/log_file
    

提交回复
热议问题