aboutsummaryrefslogtreecommitdiff
path: root/dmenu_path
diff options
context:
space:
mode:
Diffstat (limited to 'dmenu_path')
-rwxr-xr-xdmenu_path33
1 files changed, 17 insertions, 16 deletions
diff --git a/dmenu_path b/dmenu_path
index cd43748..84e3015 100755
--- a/dmenu_path
+++ b/dmenu_path
@@ -1,25 +1,26 @@
1#!/bin/sh 1#!/bin/sh -f
2CACHE=$HOME/.dmenu_cache 2CACHE=$HOME/.dmenu_cache
3IFS=: 3IFS=:
4 4
5qfind() {
6 find "$@" 2>/dev/null
7}
8
5uptodate() { 9uptodate() {
6 test ! -f $CACHE && return 1 10 test -f $CACHE &&
7 for dir in $PATH 11 test "$(echo "$PATH")" = "$(sed 1q "$CACHE")" &&
8 do 12 qfind $PATH -maxdepth 0 -newer $CACHE
9 test $dir -nt $CACHE && return 1 13}
10 done
11 return 0
12}
13 14
14if ! uptodate 15if ! uptodate
15then 16then
16 for dir in $PATH 17 {
17 do 18 echo "$PATH"
18 for file in "$dir"/* 19 qfind $PATH -type f -maxdepth 1 -perm -u+x -o -perm -g+x -o -perm -o+x |
19 do 20 sed 's,.*/,,' | sort | uniq
20 test -x "$file" && echo "${file##*/}" 21 } > $CACHE.$pid
21 done 22 mv $CACHE.$pid $CACHE
22 done | sort | uniq > $CACHE
23fi 23fi
24 24
25cat $CACHE 25tail -n +2 $CACHE
26