mirror of
https://github.com/stevenproctor/dotfiles.git
synced 2026-01-28 08:59:55 -06:00
42 lines
1.2 KiB
Bash
42 lines
1.2 KiB
Bash
# Test for an interactive shell. There is no need to set anything
|
|
# past this point for scp and rcp, and it's important to refrain from
|
|
# outputting anything in those cases.
|
|
if [[ $- != *i* ]] ; then
|
|
# Shell is non-interactive. Be done now!
|
|
return
|
|
fi
|
|
|
|
|
|
# came from Aaron Lasseigne (AaronLasseigne on GitHub)
|
|
battery_status()
|
|
{
|
|
HEART='♥ '
|
|
|
|
NON='\[\e[0m\]'
|
|
RED='\[\e[0;31m\]'
|
|
|
|
battery_info=`ioreg -rc AppleSmartBattery`
|
|
current_charge=$(echo $battery_info | grep -o '"CurrentCapacity" = [0-9]\+' | cut -d ' ' -f 3)
|
|
total_charge=$(echo $battery_info | grep -o '"MaxCapacity" = [0-9]\+' | cut -d ' ' -f 3)
|
|
|
|
charged_slots=$(echo "(($current_charge/$total_charge)*10)+1" | bc -l | cut -d '.' -f 1)
|
|
if [[ $charged_slots -gt 10 ]]; then
|
|
charged_slots=10
|
|
fi
|
|
|
|
echo -n "${RED}"
|
|
for i in `seq 1 $charged_slots`; do echo -n "$HEART"; done
|
|
echo -n "${NON}"
|
|
|
|
if [[ $charged_slots -lt 10 ]]; then
|
|
for i in `seq 1 $(echo "10-$charged_slots" | bc)`; do echo -n "$HEART"; done
|
|
fi
|
|
}
|
|
|
|
PS1="\h:\W \u\$ "
|
|
|
|
export XML_CATALOG_FILES=/usr/local/etc/xml/catalog
|
|
|
|
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
|
|
export PATH="$PATH:$HOME/.rvm/bin"
|