summaryrefslogtreecommitdiff
path: root/.local/bin/prompt
diff options
context:
space:
mode:
authorMehdi Sadeghi <mehdi@mehdix.org>2021-05-16 20:39:05 +0200
committerMehdi Sadeghi <mehdi@mehdix.org>2021-05-16 20:39:39 +0200
commiteb1dbbb8be24a284777dc341c59841051e68045a (patch)
treeb5ffb2d9226c2a5b7e9b5a92b77bff0c7eb99919 /.local/bin/prompt
parentca0f4b3eb74c4c632f1d547f46be5b6a57999dc0 (diff)
Add basic (posix) shell.
Diffstat (limited to '.local/bin/prompt')
-rwxr-xr-x.local/bin/prompt8
1 files changed, 8 insertions, 0 deletions
diff --git a/.local/bin/prompt b/.local/bin/prompt
new file mode 100755
index 0000000..90e3a17
--- /dev/null
+++ b/.local/bin/prompt
@@ -0,0 +1,8 @@
+#!/bin/sh
+BRANCH=$(git branch --show-current 2>/dev/null)
+BRANCH=$(test -d .git && test -n $BRANCH && echo "($BRANCH)")
+PROMPT="[$(hostname):$(basename "$PWD")$BRANCH]"
+case $(id -u) in
+0) echo "$PROMPT# " ;;
+*) echo "$PROMPT$ " ;;
+esac