summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKian Kasad <kdkasad@gmail.com>2020-05-09 16:32:56 -0700
committerGitHub <noreply@github.com>2020-05-09 19:32:56 -0400
commit6577acae890e18dc99244599fc85fa31053e400e (patch)
treebf4a2bcb499931889809c6cb9bca95aa9689b866
parent2b6b3822e32b11f3f6bf65cd64d4801bdacb0173 (diff)
downloadeibhear-6577acae890e18dc99244599fc85fa31053e400e.tar.gz
eibhear-6577acae890e18dc99244599fc85fa31053e400e.tar.zst
eibhear-6577acae890e18dc99244599fc85fa31053e400e.zip
replace `tr '\n' 'CHAR'` with `paste -sd 'CHAR'` (#625)
-rwxr-xr-x.local/bin/displayselect2
-rwxr-xr-x.local/bin/statusbar/music2
-rwxr-xr-x.local/bin/statusbar/nettraf4
-rwxr-xr-x.local/bin/statusbar/torrent2
-rw-r--r--.zprofile2
5 files changed, 6 insertions, 6 deletions
diff --git a/.local/bin/displayselect b/.local/bin/displayselect
index 02b35c2..57120ec 100755
--- a/.local/bin/displayselect
+++ b/.local/bin/displayselect
@@ -53,7 +53,7 @@ multimon() { # Multi-monitor handler.
esac ;}
onescreen() { # If only one output available or chosen.
- xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$1" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ')
+ xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ')
}
postrun() { # Stuff to run to clean up.
diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music
index 6d22467..8c60919 100755
--- a/.local/bin/statusbar/music
+++ b/.local/bin/statusbar/music
@@ -1,6 +1,6 @@
#!/bin/sh
-filter() { mpc | sed "/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | tr '\n' ' ' | sed 's/ $//' ;}
+filter() { mpc | sed "/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | paste -sd ' ';}
case $BLOCK_BUTTON in
1) mpc status | filter ; setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause
diff --git a/.local/bin/statusbar/nettraf b/.local/bin/statusbar/nettraf
index bac22d8..d96d979 100755
--- a/.local/bin/statusbar/nettraf
+++ b/.local/bin/statusbar/nettraf
@@ -13,8 +13,8 @@ esac
rxfile="${XDG_CACHE_HOME:-$HOME/.cache}/rxlog"
txfile="${XDG_CACHE_HOME:-$HOME/.cache}/txlog"
-rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | tr '\n' '+' | sed 's/+$/\n/' | bc)"
-txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | tr '\n' '+' | sed 's/+$/\n/' | bc)"
+rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+' | bc)"
+txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+' | bc)"
printf "🔻%skB 🔺%skB\\n" \
"$(printf -- "(%s-%s)/1024\\n" "$rxcurrent" "$(cat "$rxfile")" | bc)" \
diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent
index 99ed5c8..a550c62 100755
--- a/.local/bin/statusbar/torrent
+++ b/.local/bin/statusbar/torrent
@@ -14,7 +14,7 @@ transmission-remote -l | grep % |
s/L/🔼/g;
s/M/🔽/g;
s/N/✅/g;
- s/Z/🌱/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed 's/ $//'
+ s/Z/🌱/g" | awk '{print $2, $1}' | paste -sd ' '
case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e tremc & ;;
diff --git a/.zprofile b/.zprofile
index 20c9a82..de77ad1 100644
--- a/.zprofile
+++ b/.zprofile
@@ -6,7 +6,7 @@
# to clean up.
# Adds `~/.local/bin` to $PATH
-export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')"
+export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | paste -sd ':')"
# Default programs:
export EDITOR="nvim"