oops, sed error

This commit is contained in:
Luke Smith
2020-04-08 19:06:11 -04:00
parent 0948cd95f3
commit 7f334ff4b9
13 changed files with 23 additions and 23 deletions

View File

@@ -5,7 +5,7 @@
# Must have xclip installed to even show menu.
xclip -h 2>/dev/null || exit 1
chosen=$(cut -d ';' -f1 ${XDG_DATA_HOME:$HOME/.local/share}/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//")
chosen=$(cut -d ';' -f1 ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//")
[ "$chosen" != "" ] || exit

View File

@@ -1,5 +1,5 @@
#!/bin/sh
cat ${XDG_DATA_HOME:$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit
cat ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit
echo "Run command with one of the following arguments for info about that program:"
ls ${XDG_DATA_HOME:$HOME/.local/share}/larbs/getkeys
ls ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys

View File

@@ -2,7 +2,7 @@
# Toggles the LARBS welcome message.
PIC="${XDG_DATA_HOME:$HOME/.local/share}/larbs/larbs.png"
PIC="${XDG_DATA_HOME:-$HOME/.local/share}/larbs/larbs.png"
grep LARBSWELCOME "$HOME/.xprofile" &&
( sed -i "/LARBSWELCOME/d" ~/.xprofile && notify-send -i "$PIC" "LARBS welcome message" "Welcome message disabled. Press Super+Shift+F1 again to reverse." ) ||

View File

@@ -4,4 +4,4 @@
[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit
echo ${XDG_DATA_HOME:$HOME/.local/share}/newsboat/queue | entr -p queueandnotify 2>/dev/null
echo ${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue | entr -p queueandnotify 2>/dev/null

View File

@@ -3,7 +3,7 @@
# Podboat sucks. This script replaces it.
# It reads the newsboat queue, queuing downloads with taskspooler.
# It also removes the junk from extentions.
queuefile="${XDG_DATA_HOME:$HOME/.local/share}/newsboat/queue"
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
while read -r line; do
[ -z "$line" ] && continue

View File

@@ -1,7 +1,7 @@
#!/bin/sh
case $BLOCK_BUTTON in
1) groff -mom ${XDG_DATA_HOME:$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - ;;
1) groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - ;;
2) i3 restart ;;
3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide.
- Middle click to refresh i3.";;

View File

@@ -13,7 +13,7 @@ case $BLOCK_BUTTON in
- Middle click syncs mail" ;;
esac
unread="$(find ${XDG_DATA_HOME:$HOME/.local/share}/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)"
unread="$(find ${XDG_DATA_HOME:-$HOME/.local/share}/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)"
icon="$(cat "/tmp/imapsyncicon_$USER")"

View File

@@ -7,18 +7,18 @@
# You could set up a shell alias to view the full file in a pager in the
# terminal if desired. This function will only be run once a day when needed.
getforecast() { ping -q -c 1 1.1.1.1 >/dev/null &&
curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" || exit 1 ;}
curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" || exit 1 ;}
# Some very particular and terse stream manipulation. We get the maximum
# precipication chance and the daily high and low from the downloaded file and
# display them with coresponding emojis.
showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" |
showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔ /g;1q" | tr -d '\n')"
sed '13q;d' "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}' ;}
sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}' ;}
# The BLOCK_BUTTON bloat for clicking in i3.
case $BLOCK_BUTTON in
1) $TERMINAL -e less -Srf "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" ;;
1) $TERMINAL -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" ;;
2) getforecast && showweather ;;
3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast.
- Middle click to update forecast.
@@ -29,7 +29,7 @@ esac
# The test if our forcecast is updated to the day. If it isn't download a new
# weather report from wttr.in with the above function.
[ "$(stat -c %y "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
[ "$(stat -c %y "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
getforecast
showweather