| @@ -369,7 +369,7 @@ battery-status(){ | |||||
| local full=$(cat $dir/charge_full) | local full=$(cat $dir/charge_full) | ||||
| local now=$(cat $dir/charge_now) | local now=$(cat $dir/charge_now) | ||||
| local rate=$(expr $now \* 100 / $full) | local rate=$(expr $now \* 100 / $full) | ||||
| printf $1 "${st}:${rate}%" | |||||
| printf "$1" "${st}:${rate}%" | |||||
| fi | fi | ||||
| } | } | ||||
| alias bat='battery-status %s\\n' | alias bat='battery-status %s\\n' | ||||
| @@ -404,13 +404,7 @@ __my_prompt_function(){ # used by PS1 | |||||
| then | then | ||||
| local pwd=$PWD | local pwd=$PWD | ||||
| local oldpwd=$OLDPWD | local oldpwd=$OLDPWD | ||||
| local jobnum= | |||||
| if git branch >/dev/null 2>&1 | |||||
| then | |||||
| local git="[GIT]" | |||||
| else | |||||
| local git= | |||||
| fi | |||||
| git branch >/dev/null 2>&1 && local git="[GIT]" | |||||
| local date=$(/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%') | local date=$(/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%') | ||||
| else | else | ||||
| local pwd=$(echo "${PWD}/" | sed -e "s#${HOME}#~#") | local pwd=$(echo "${PWD}/" | sed -e "s#${HOME}#~#") | ||||
| @@ -423,12 +417,14 @@ __my_prompt_function(){ # used by PS1 | |||||
| if test -z "$DISPLAY" | if test -z "$DISPLAY" | ||||
| then | then | ||||
| local ip=$(ip-address [Addr:%s]) | local ip=$(ip-address [Addr:%s]) | ||||
| test -f ~/.batterystatus && local battery="[Battery:$(cat ~/.batterystatus | sed -e 's`%`%%`g')]" | |||||
| test -f /tmp/batterystatus && local battery="[Battery:$(sed -e 's`%`%%`g' /tmp/batterystatus)]" | |||||
| battery-status %s >/tmp/batterystatus & | |||||
| fi | fi | ||||
| local tty=$(__try_exec tty | sed -e 's:/dev/::') | local tty=$(__try_exec tty | sed -e 's:/dev/::') | ||||
| # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow | # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow | ||||
| printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" | printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" | ||||
| printf "${c2}${USER}@${HOSTNAME}${cdef} ${tty} ${date} ${BASH} ${BASH_VERSION}\n" | printf "${c2}${USER}@${HOSTNAME}${cdef} ${tty} ${date} ${BASH} ${BASH_VERSION}\n" | ||||
| printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " | printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " | ||||
| } | } | ||||