commit 8b4a047768c7cfe95b23475f57fe113ddfe81e2e
parent 9d5a241f1dbe10c96257a56b62dfd9d3767a68f1
Author: Chris Down <chris@chrisdown.name>
Date: Sat, 7 Jan 2017 14:30:55 +0000
Use awk instead of uniq to only keep latest, even if not adjacent
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clipmenu b/clipmenu
@@ -9,7 +9,7 @@ cache_file=$cache_dir/line_cache
# whether `-l` is also in "$@", because the way that dmenu works allows a later
# argument to override an earlier one. That is, if the user passes in `-l`, our
# one will be ignored.
-chosen_line=$(tac "$cache_file" | uniq | dmenu -l 8 "$@")
+chosen_line=$(tac "$cache_file" | awk '!seen[$0]++' | dmenu -l 8 "$@")
[[ $chosen_line ]] || exit 1