I have the following in Bash (In Linux)
for dir in Movies/*
do
(cd "$dir" && pwd|cut -d \/ -f5|tr -s '\n' ', ' >> ../../movielist &&
exiftool * -t -s3 -ImageSize -FileType|tr -s '\t' ',' >> ../../movielist )
echo "Movie $movies - $dir ADDED!"
let movies=movies+1
done
But I wish to make it so the “echo” shows the following echo on the next line (Not concatenate with the last echo output but replace it) so to make it look like it is updating. Similar to how a progress bar with percent would show on the same line.
Well I did not read correctly the
man echopage for this.echohad 2 options that could do this if I added a 3rd escape character.The 2 options are
-nand-e.-nwill not output the trailing newline. So that saves me from going to a new line each time I echo something.-ewill allow me to interpret backslash escape symbols.Guess what escape symbol I want to use for this:
\r. Yes, carriage return would send me back to the start and it will visually look like I am updating on the same line.So the echo line would look like this:
I had to escape the escape symbol so bash would not kill it. That is why you see 2
\symbols above.As mentioned by William,
printfcan also do similar (and even more extensive) tasks like this.