It turns out that I am studying scripting programming and I have to ask a question where I am asked to create a PS1 by customizing the terminal prompt so that the username is displayed, in which the vowels are replaced by numbers (a = 1, e = 2, i = 3...), the date and the current route. I have been looking for how to customize the PS1 and I have found several pages where they specify how this can be done. However, I can't find a way to replace the vowels in the username with numbers and have them be reflected on the PS1. From the notes I have, I know that a way to substitute vowels for numbers would be:
tr aeiou 12345
usuario
5s51r34
But I don't know how I could put that command in the PS1 since, according to what I have seen, the structure to put the user, date and path would be:
PS1="\u \d \W"
What returns me:
usuario lun oct 12 ~
Would anyone know how I could perform the tr command to make the substitution within the PS1 customization?
I guess you could put something like
PS1=$( echo -n hola soy $USER )
. Whatever is inside$( )
will be executed and the output will be shown as the prompt... but that's an educated guess on my part. One project where I know they do tricks like this is bash-git-prompt. Take a look at how they do it: https://github.com/magicmonty/bash-git-prompt