Append command line output dynamically
Posted: 13 Dec 2011 09:10
Sorry for the surreal subject, but I wasn't sure how to describe this in a one liner. What I'd like to be able to do is basically avoid generating a newline in my output, something like this:
echo "Processing xyz..."
[script does some stuff]
Then actually append something like an "ok" at the end of the existing output line so it ultimately looks like this when it's processing is done:
As opposed to a newline being generated like this:
I don't want to just build the whole string and then display it when the processing is done because I want to have visual feedback on when the processing has started, how long it's taking for each item, which item it might hang on, etc.
Any suggestions appreciated - hope this was a clear as mud!
echo "Processing xyz..."
[script does some stuff]
Then actually append something like an "ok" at the end of the existing output line so it ultimately looks like this when it's processing is done:
Code: Select all
Processing xyz... ok
As opposed to a newline being generated like this:
Code: Select all
Processing xyz...
ok
I don't want to just build the whole string and then display it when the processing is done because I want to have visual feedback on when the processing has started, how long it's taking for each item, which item it might hang on, etc.
Any suggestions appreciated - hope this was a clear as mud!