bash-prompt-generator
bash-prompt-generator copied to clipboard
Focus lose and IP-Method
Hello,
I love your Generator. I use it on nearly all my Linuxes (as long as I can copy the text there ... newbie-problems...).
But it seems sometimes it loses the focus or does not react, so I have to exit or close that bash and start a new one.
I use the following output: PS1='[\e[0;4;96m]$(ip route get 1.1.1.1 | awk -F"src " '"'"'NR==1{split($2,a," ");print a[1]}'"'"')[\e[0;4;96m]|[\e[0;4;92m]\H[\e[0;4;92m]|[\e[0;4;38;5;208m]\u[\e[0;4;38;5;208m]|[\e[0;4;93m]\w[\e[0;4;93m]:[\e[0m]'
I < think it has something to do with (ip route and awk) part.
So any change to change that to this? >> hostname -I | cut -d' ' -f1
(Found here: https://stackoverflow.com/questions/13322485/how-to-get-the-primary-ip-address-of-the-local-machine-on-linux-and-os-x?page=1&tab=modifieddesc#tab-top)
And if yes, how do I implement that in the above PS1 ???? (or will you implement both or more methods in the Generator?)
Regards
I love your Generator. I use it on nearly all my Linuxes (as long as I can copy the text there ... newbie-problems...).
:)
But it seems sometimes it loses the focus or does not react, so I have to exit or close that bash and start a new one.
I use the following output: PS1='[\e[0;4;96m]$(ip route get 1.1.1.1 | awk -F"src " '"'"'NR==1{split($2,a," ");print a[1]}'"'"')[\e[0;4;96m]|[\e[0;4;92m]\H[\e[0;4;92m]|[\e[0;4;38;5;208m]\u[\e[0;4;38;5;208m]|[\e[0;4;93m]\w[\e[0;4;93m]:[\e[0m]'
I < think it has something to do with (ip route and awk) part.
This is most likely a bug. I will have a look at it once I find the time. Thank you for pointing it out. If you could provide any more specific details on how to reproduce the problem, I would be very grateful.
So any change to change that to this? >> hostname -I | cut -d' ' -f1
And if yes, how do I implement that in the above PS1 ???? (or will you implement both or more methods in the Generator?)
The IP Address
element is basically just a Command
element with a predefined command. You can use a Command
element with an arbitrary command at any time. In your case you would have to add a Command
element and then insert hostname -I | cut -d' ' -f1
in the input field under Properties. After that it should work the way you want it to.
The only downside is that doing something like this often breaks the prompt input on the generator site (which is still experimental anyway ^^).