0

I've got a line in my bash script like this:

echo "`some_command`"

Now, some_command executes for around 1-2mins and it keeps printing alerts/messages in that interval.

Problem is when I execute my bash script, the script has no output for 1-2mins and then directly displays the output after complete execution of some_command.

How can I make my bash script output some_command as it is executing? Is there a way to do so?

2
  • 3
    Other than just running some_command? Commented Dec 4, 2017 at 12:18
  • 3
    That's a useless use of echo Commented Dec 4, 2017 at 12:19

1 Answer 1

4

The command substitution is capturing everything your command writes to standard output, then displayed all at once by the echo command. Just run the command by itself. (And when you do want a command substitution, use $(...) instead of backticks.)

some_command  # not echo "$(some_command)"
Sign up to request clarification or add additional context in comments.

1 Comment

I can't believe I didn't think of this!! I feel like an idiot! Arghhhh! :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.