NeapTide
Technical Blog
Browse: Home / bash

bash

Little Helpers

By Bernhard on December 15, 2012

There is often a need to debug scripts which are started by daemons, so you have no input/output available. The following snippet easily redirects stdout and stderr to a file: #!/bin/bash exec >> /tmp/script_debug.log 2>&1 set -x echo Start: $(date) : buggy code echo Stop: $(date) and here the output: $ cat /tmp/script_debug.log ++ date [...]

Posted in bash, linux, shell | Tagged bash, debug, debugging, exec, redirect, shell | Leave a response

Next »
About NeapTide.org