[wiki] [sites] Fixed new line insertion issue in cache file when the entries are not selected and optimised code. || ananthu
commit f04687cc79f065e9ebed46714bbb90071619aaf6
Author: ananthu <ask1234560_AT_gmail.com>
Date: Mon Jul 13 22:09:47 2020 +0530
Fixed new line insertion issue in cache file when the entries are not selected and optimised code.
diff --git a/tools.suckless.org/dmenu/scripts/run-recent b/tools.suckless.org/dmenu/scripts/run-recent
index 7e99c5fc..7c81bc6f 100755
--- a/tools.suckless.org/dmenu/scripts/run-recent
+++ b/tools.suckless.org/dmenu/scripts/run-recent
_AT_@ -7,12 +7,12 @@ cache="$cachedir/dmenu_recent"
touch "$cache"
-most_used=$(sort "$cache" | uniq -c | sort -r | awk '{print $2}')
+most_used=$(sort "$cache" | uniq -c | sort -r | cut -d" " -f8)
run=$((echo "$most_used"; dmenu_path | grep -vxF "$most_used") | dmenu -i "$_AT_")
-(echo "$run"; head -n 99 "$cache") > "$cache.$$"
+([ -z "$run" ] || echo "$run"; head -n 99 "$cache") > "$cache.$$"
mv "$cache.$$" "$cache"
case "$run" in
- *\;) exec $(echo $term "$run" | sed -e 's/;$//') ;;
+ *\;) exec $(echo $term ${run%;}) ;;
*) exec "$run" ;;
esac
Received on Mon Jul 13 2020 - 18:42:53 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 13 2020 - 18:48:47 CEST