3

Take a look on the following

# more /tmp/myscript #!/bin/bash echo I AM echo BIG GUY echo AND ALSO SMART # bash /tmp/myscript | tee -a >/tmp/log 

why we not get the output from echo in the script to the console?

actually output redirect to the log - /tmp/logbut not also to the standard output

its very strange because tee -a should redirect top log and also to stand art output

what is the right way to write to log and print to console ?

expected output

# bash /tmp/myscript | tee -a >/tmp/log I AM BIG GUY AND ALSO SMART 

    1 Answer 1

    7

    That's because you use the redirection of output >. tee should do the redirection, not the shell. Try without >:

    bash /tmp/myscript | tee -a /tmp/log 

      You must log in to answer this question.

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.