0

I'm using an CLI Arch Linux and I want to run an Shell/Bash Script to show the status of my Battery with acpi directly on the String Prompt(PS1).

I create the following Shell Script to Show me the Battery Status:

# Permition Acess: chmod +x loop.sh
# run .sh: ./loop.sh

i=true
#COLOR:
ORANGE='\e[33m'
STOP='\e[0m'

while ($i = true)
do
 printf ${ORANGE}
 echo $(clear)
 echo $(acpi -b)
 sleep 1
printf ${STOP}
done

My Idea is to Connect the Script on PS1 to keep showing the Battery Status always update!

My Current PS1 is:

PS1='[${OR}USER: \u ${B}TIME: \t ${C}DIR: \W ${RED}$(__git_ps1 " (%s)")]\n[${LG}$(acpi -b)${R}]\n\$

I'm calling the acpi but he only update when I use some command

F4NT0
  • 508
  • added! there is a way to initiate a shell script inside PS1? – F4NT0 May 18 '18 at 23:47