I have some status text displayed in a BASH script, e.g.:
Removed file "sandwich.txt". (1/2)
Removed file "fish.txt". (2/2)
I would like to have the progress text (1/2) appear entirely to the right, lined up with the edge of the terminal window, e.g.:
Removed file "sandwich.txt". (1/2)
Removed file "fish.txt". (2/2)
I have tried solutions at right align/pad numbers in bash and right text align – bash, however, the solutions do no seem to work, they just make a large white space, e.g.:
Removed file "sandwich.txt". (1/2)
Removed file "fish.txt". (2/2)
How can I have some of the text left aligned and some of the text right aligned?
The double quotes around the file name are eclectic, but get the file name enclosed in double quotes to the
printf()command, which will then print that name left justified in a field of width 64.Adjust to suit.