I want to create a bash prompt that starts with the history number padded with zeros, so that it is always at least three characters long:
001 user@hostname:~ $
I tried padding the special PS1 symbol \! with printf:
function padded_history {
printf "%03d" "\!"
}
PS1="$(padded_history) \u@\h:\w \$"
But I get the following error:
-bash: printf: \!: invalid number