Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .