I'm attempting to execute a shell script concurrently from a makefile and have all of the output go to stdout though when I do, the newlines become garbled and the only reliable fix I've found is to reset
.
makefile:
all: t1 t2 t3 t4
t1 t2 t3 t4:
@./test.sh true
test.sh:
#!/bin/bash
script -q /dev/null "$@" 2>&1 > /dev/null 2>&1
Invocation:
$ make -j
No output as you would expect, but sometimes it breaks the terminal and I have to reset
.
Sometimes newlines and carriage returns don't work after it runs:
Devbox:Desktop user$ time make -j
real 0m0.019s
user 0m0.019s
sys 0m0.022s
Devbox:Desktop user$
Removing script
from the script and replacing that line with "$@"
allows it to work just fine, but I'm using script to preserve color output from the command.
LOG=$(script -q /dev/null "$@" 2>&1 | tr -d '\r' | cat)