Inline file descriptor redirection of a bash script
If the title doesn't make any sense it's probably because I made that name up. But what I actually mean simply looks like this:
exec 1>$SOME_LOG_FILE
exec 2>&1
Ring a bell, huh?
Have known this tip for some time but have rarely used it. On a recent occasion I had to revisit it and digged a bit deeper, thanks to this great blog post that explained it thoroughly.
没有评论:
发表评论