Skip to content
Advertisement

issue when saving script output to file

I have an install script that I want to save its output to a file, I have tried ./install.sh 2>&1 | tee /tmp/install.log

it writes to the file, but my issue is this:

  • script outputon console without tee
Loading docker image Test  
aeb3f02e9374: Loading layer [=================================>]  75.27MB/75.27MB  
db978cae6a05: Loading layer [=================================>]  15.36kB/15.36kB  
c20d459170d8: Loading layer [=================================>]  3.072kB/3.072kB  
18a8dee8b021: Loading layer [=================================>]  402.6MB/402.6M    
cf2fcaf5666c: Loading layer [=================================>] 100.4kB/100.4kB      
Loaded image: test:latest
  • script output on console and file with tee
Loading docker image Test       
Loaded image: test:latest

Loading layers info is not printed at all, neither on console nor file, any idea why this happens?

Advertisement

Answer

Issue solved with:

script –return –quiet -c “./install.sh 2>&1” /tmp/install.log

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement