diff options
-rwxr-xr-x | dmenu_path | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -1,25 +1,26 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh -f |
2 | CACHE=$HOME/.dmenu_cache | 2 | CACHE=$HOME/.dmenu_cache |
3 | IFS=: | 3 | IFS=: |
4 | 4 | ||
5 | qfind() { | ||
6 | find "$@" 2>/dev/null | ||
7 | } | ||
8 | |||
5 | uptodate() { | 9 | uptodate() { |
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 | ||
14 | if ! uptodate | 15 | if ! uptodate |
15 | then | 16 | then |
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 | ||
23 | fi | 23 | fi |
24 | 24 | ||
25 | cat $CACHE | 25 | tail -n +2 $CACHE |
26 | |||