commit f04687cc79f065e9ebed46714bbb90071619aaf6 parent 06838e29d367046b9304b392d58ff7075d51c1e1 Author: ananthu <ask1234560@gmail.com> Date: Mon, 13 Jul 2020 22:09:47 +0530 Fixed new line insertion issue in cache file when the entries are not selected and optimised code. Diffstat:
M | tools.suckless.org/dmenu/scripts/run-recent | | | 6 | +++--- |
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools.suckless.org/dmenu/scripts/run-recent b/tools.suckless.org/dmenu/scripts/run-recent @@ -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 "$@") -(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