Server DIY Backup script redirect debug messages to stderr

In "utils.sh" there is a function called "run", with this comment:

"Log then execute the provided command".

This is the last row of the function:

"debug "Running${cmdline}" > /dev/stderr"

 

Please explain me why a debug message should go to the stderr instead of the stdout? (it's a debug message!)

1 answer

0 vote

Hi Ezio, it looks to be a general preference to have debugging messages sent to stderr instead of stdout. For example, from Stackoverflow :

 

Regular output (the actual result of running the program) should go on stdout, things like diagnostic, notice, warning, error, etc, go on stderr.

If there is no "regular output", I would say that it doesn't really matter which one you choose. You could argue that the logging is the only output, so that should go to stdout. Or you could argue that it is still "exceptional information" which should go to stderr.

The backup scripts don't really have regular output, so we 're sending those messages to stderr.
 
Hope this helps!
Ana

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

30,470 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you