Sample Header Ad - 728x90

exec redirects in bash

11 votes
1 answer
16295 views
I write a lot of non-interactive scripts where I would like all output to go to a log file and have nothing appear on-screen. To solve this, I've been using: #!/bin/bash exec &> logfile echo "Step One:" /some/command/one echo "Step Two:" /some/command/two I want to make sure this is a sane method. Are there any significant drawbacks or issues I'm going to encounter if I move forward with this methodology? If so, what are they and how best can they be mitigated (including by changing my methodology).
Asked by Rob (273 rep)
Feb 10, 2015, 11:04 PM
Last activity: Feb 10, 2024, 09:38 PM