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 .
2
  • 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.
    – Wild Goat
    Commented Sep 21, 2015 at 21:00
  • Are you still wrapping it in echo $(...)? That's the part I'm saying is unnecessary.
    – chepner
    Commented Sep 21, 2015 at 21:01

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.