Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a shell script with the following:

STATUS=`/home/scripts/200check.sh $RUOK_URL`

Inside of 200check.sh I have some echo commands, but these commands are not displayed in the terminal. I guess they're consumed by something else?

Does anyone know how I can have the echo commands displayed?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

echo outputs messages to stdout, and they are captured by the very same ` ` operator.

It's standard practice to send warnings or error messages to stderr instead. In bash, you would use:

echo "warning: blah" >&2

stderr is normally not affected by pipes or command substitution operators (although it can still be redirected).

share|improve this answer
    
Excellent, thanks very much. I'm pretty new to Shell Scripting, thanks again. –  C0deAttack Sep 14 '11 at 16:33

The output from the script is saved in the $STATUS variable because you invoke it using back-ticks (a nicer way of doing it would be to use $(...), which nests easier). Try displaying the value of $STATUS to see if your expected output is there.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.