aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2021-06-20 01:38:34 -0400
committertdro <tdro@users.noreply.github.com>2021-06-20 01:38:34 -0400
commit4ac768629a0740299418e7ca2102e025f0b3d853 (patch)
tree53027e1f50098b049258b616fbc08cdb4dde0dbd
parentc661b37908eec45121870b05d1248c31c9c7e015 (diff)
downloaddotfiles-4ac768629a0740299418e7ca2102e025f0b3d853.tar.gz
dotfiles-4ac768629a0740299418e7ca2102e025f0b3d853.tar.bz2
dotfiles-4ac768629a0740299418e7ca2102e025f0b3d853.zip
.local/bin/dmenu_run_history: Remove failed items
-rwxr-xr-x.local/bin/dmenu_run_history8
1 files changed, 3 insertions, 5 deletions
diff --git a/.local/bin/dmenu_run_history b/.local/bin/dmenu_run_history
index 4f276dd..e5fc394 100755
--- a/.local/bin/dmenu_run_history
+++ b/.local/bin/dmenu_run_history
@@ -14,10 +14,9 @@ if [ "$1" = "update" ] || [ ! -f "$cache" ]; then
IFS=:;
stest -flx $PATH | sort -u > "$cache";
unset IFS;
- exit;
fi
-awk -v histfile=$historyfile '
+awk -v histfile="$historyfile" '
BEGIN {
while( (getline < histfile) > 0 ) {
sub("^[0-9]+\t","")
@@ -26,7 +25,7 @@ awk -v histfile=$historyfile '
}
} !x[$0]++ ' "$cache" \
| dmenu -b ${dmenu_args:--p Launch} "$@" \
- | awk -v histfile=$historyfile '
+ | awk -v histfile="$historyfile" '
BEGIN {
FS=OFS="\t"
while ( (getline < histfile) > 0 ) {
@@ -48,5 +47,4 @@ awk -v histfile=$historyfile '
for (f in history)
print history[f],f | "sort -t '\t' -k1rn >" histfile
}
- ' \
- | while read -r cmd; do ${SHELL:-"/bin/sh"} -c "$cmd_prefix $cmd" & done
+ ' | while read -r cmd; do ${SHELL:-"/bin/sh"} -c "$cmd_prefix $cmd || sed -i '/$cmd/d' $historyfile" & done