I am trying to add a battery blugin to my prompt https://github.com/Goles/Battery.
PROMPT="╭─${user_host} ${current_dir} ${git_branch} `battery`
╰─%B$%b "
RPS1="${return_code}"
I need to escape the percent sign, which can be done by getting the string output and then replacing it with two parenthesis, but I have failed at scripting that. My prompt looks like the top line but I want it to appear like it is in the third line. Any easy fixes to this?
I have problem executing the
battery
command from the github, but I may know you problem. I use zsh too. In zsh you have to add additional % sign to escape the %. You can try to change thebattery
command tobattery | sed 's/%/%%/'
, i.e, your prompt should look like this: