From 4622ef55f9686192eef4e5d4ce540d77d7d94e6c Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Sat, 4 Jun 2022 17:31:41 +0930 Subject: [PATCH] added some bash related scripts --- scripts/bash-status-bat | 8 ++++++++ scripts/bash-status-git | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100755 scripts/bash-status-bat create mode 100755 scripts/bash-status-git diff --git a/scripts/bash-status-bat b/scripts/bash-status-bat new file mode 100755 index 0000000..9c41b11 --- /dev/null +++ b/scripts/bash-status-bat @@ -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" diff --git a/scripts/bash-status-git b/scripts/bash-status-git new file mode 100755 index 0000000..3454f5f --- /dev/null +++ b/scripts/bash-status-git @@ -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