How to alter the string format of the text between the line number and the history entry in the output of history in bash?
If running history in bash prints, for example:
5 history
how to change that to this, for instance:
5....history
or
5_anyString_history
Also, alignment is done by history already, by adjusting the number of spaces. How to include this functionality as well? That is, if . is used as the string, how to change the number of dots according to the number of digits in the line number? Also, I’d like to remove the leading spaces.
When I do
history, there is always two spaces after the line number. The alignment is done by varying the number of spaces before the number.This is an example of how to replace the leading spaces (which vary in number):
Edit:
This version works similarly to the second one above, but it moves the dots after the numbers so there are no leading spaces and the variable number of dots cause the history entries to be left aligned.
This is how it works:
:a– label for branchingta– branch to label:aif a replacement is made, once all the leading spaces are replaced, continue past the branch instruction