In bash one can !-1 to execute the 1 command from the history enumerated from the end starting at 0. But what how can one view history so that mentioned enumeration is shown instead of usual one by built-in means? Of course one can write a simple script for that but I feel like there should be some kind of option for that.
Another question is if there is a way to somehow switch history expansion so that - sign would be unnessasary. Say exchanging meaning of !1 and !-1.
Showing negative indices is simple to implement. Just take the length of history (or get it from
history 1), and subtract it from the index of all other history items.I don’t see any built-in ways to affect history’s output like this nor change how indices in history expansion works.