aboutsummaryrefslogtreecommitdiff
path: root/bin/vcs
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-01-04 11:23:50 -0300
committerEuAndreh <eu@euandre.org>2024-01-04 11:23:55 -0300
commit07455024c72c3aa0bacf8338b82d3a0b8a96a9b0 (patch)
treec3e7074928e2783d9e97001f45e2a3522d52ba76 /bin/vcs
parentetc/sh/rc: Fix "c" alias to use the correct command (diff)
downloaddotfiles-07455024c72c3aa0bacf8338b82d3a0b8a96a9b0.tar.gz
dotfiles-07455024c72c3aa0bacf8338b82d3a0b8a96a9b0.tar.xz
re "s|echo \"\\\$|printf '%s\\\n' \"\$|g"
Replace all cases where `echo` was given a variable as its first argument, even on cases where we always know what the variable's content look like.
Diffstat (limited to 'bin/vcs')
-rwxr-xr-xbin/vcs12
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/vcs b/bin/vcs
index b51cf33..2f2c4f6 100755
--- a/bin/vcs
+++ b/bin/vcs
@@ -68,15 +68,15 @@ git_diff() {
git_ps1() {
BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
OUT="$(git status --short --branch --porcelain)"
- BRANCH_LINE="$(echo "$OUT" | head -n 1)"
- DIFF_LINES="$(echo "$OUT" | tail -n +2)"
+ BRANCH_LINE="$(printf '%s\n' "$OUT" | head -n 1)"
+ DIFF_LINES="$(printf '%s\n' "$OUT" | tail -n +2)"
IS_AHEAD=false
IS_BEHIND=false
- if echo "$BRANCH_LINE" | grep -q 'ahead'; then
+ if printf '%s\n' "$BRANCH_LINE" | grep -q 'ahead'; then
IS_AHEAD=true
fi
- if echo "$BRANCH_LINE" | grep -q 'behind'; then
+ if printf '%s\n' "$BRANCH_LINE" | grep -q 'behind'; then
IS_BEHIND=true
fi
@@ -94,10 +94,10 @@ git_ps1() {
HAS_DIFF=false
HAS_UNTRACKED=false
- if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then
+ if printf '%s\n' "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then
HAS_DIFF=true
fi
- if echo "$DIFF_LINES" | grep -Eq '^([?][?]| A)'; then
+ if printf '%s\n' "$DIFF_LINES" | grep -Eq '^([?][?]| A)'; then
HAS_UNTRACKED=true
fi