4 ms·
Can't remember exactly how I did it. However I found something similar that waits for a command to complete sed instead of grep. sed exists after the first matc
by _jomo 12y ago
Can't remember exactly how I did it. However I found something similar that waits for a command to complete sed instead of grep. sed exists after the first match:
send_to_mc "/wb SomeWorld trim 100 15 C-m"
sleep 1
send_to_mc "/wb trim confirm"
tail -n 0 -F "logs/latest.log" | sed "/trimmed so far (100.0% done)/q"
send_to_mc "/broadcast Chunk deletion done"
send_to_mc is simply sending $1 + return to tmux:
tmux send -t "$tmux_session" "$1" C-m
/wb is a command from the WorldBorder [0] command that is (in this case) used to delete all chunks (which were generated for some reason) beyond the border.
using while read line is probably the best option if you want to continuously check the logs
You could also use awk isntead of grep:
awk "/pattern/{print $0}"
0: https://github.com/Brettflan/WorldBorder https://github.com/Brettflan/WorldBorder
EDIT: Completely misunderstood your problem. I thought grep wouldn't output to stdout until EOF. Seems like a loop is the only option