It's UWAweek 48


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 564 articles.
Currently 2 other people reading this forum.

 UWA week 12 (1st semester, week 4) ↓
SVG not supported

Login to reply

12:32pm Thu 24th Mar, Michael W.

> Hi, here some quick questions > in today demo, we get debugging code like > if [[ conditions ]] > then echo "xxxx" > /dev/stderr > exit 0 > fi > > question is: > for echo "xxxx" > /dev/stderr , why we need write it into /dev/stderr, what is /dev/stderr for. > > and for "exit 0", is it only for telling people that your program running successfully? > > best regards
Hi, As someone else has pointed out more recently, we use stderr in order to keep error messages, status updates, etc (i.e. not directly relevant to the purpose of the program) away from the program outputs that you, presumably, are interested in. I used exit 0 in the case of the usage message, because it's common Unix practice to type a command name without arguments (or sometimes with -h flag) if you just want to know the calling arguments. On that basis, you are getting back what you expect , so exit 0 (ie success) is reasonable. For genuine errors, exit 1 (or some other positive integer) is entirely appropriate. Makes sense? Cheers MichaelW

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy