I have a kubernetes command kubectl get pods which prints to the terminal this output
NAME READY STATUS RESTARTS AGE redis-cart-74594bd569-ffrhk 1/1 Running 0 40m I want this command to run repeatedly every two seconds in a bash script. However, I want the output to overwrite the last input.
Currently, I can get it to overwrite one line (the first outputted line) by using a carriage return. But it doesn't overwrite the second line.
How can I overwrite previously outputted text from my bash script?
By script looks like this atm
#!/bin/bash variable=$(kubectl get pods) while true do variable=$(kubectl get pods) echo -ne "$variable" "\r" sleep 2 done exit
watch.watchcommands existence, looking into it now