added some bash related scripts

This commit is contained in:
Solomon Laing 2022-06-04 17:31:41 +09:30
parent 0da5fdf121
commit 4622ef55f9
2 changed files with 19 additions and 0 deletions

8
scripts/bash-status-bat Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
current=$(acpi --battery | sed -e 's/%.*//' | sed 's/.*, //')
status="$current%"
state=$(acpi --battery | sed -e 's/,.*//' | sed 's/.*: //')
echo "$current% $state"

11
scripts/bash-status-git Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
if git status &>/dev/null; then
branch=$(git branch --show-current)
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then
echo "($branch~)"
else
echo "($branch*)"
fi
fi