0

I have a current bash script. echo will display all results when cmd has been finished. But I want in real time see output coming line by line when script is in execution process. How can I achieve that?

#!/bin/bash
echo $(docker build -t goapp -f deployments/dev/Dockerfile .)
1
  • 2
    docker build -t goapp -f deployments/dev/Dockerfile . >> someFile.log and tail -f someFile.log may do the trick Commented Sep 21, 2015 at 20:54

1 Answer 1

2

docker already prints its output to standard output; that's why you can capture it with $(...) and pass it as arguments to echo. Just run docker:

#!/bin/bash
docker build -t goal -f deployments/dev/Dockerfile .
Sign up to request clarification or add additional context in comments.

2 Comments

it stream all output if I execute that cmd manually in terminal but if I wrap it in bash .sh script it prints it only when cmd has been finished.
Are you still wrapping it in echo $(...)? That's the part I'm saying is unnecessary.

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.