]> git.armaanb.net Git - dmenu.git/blob - dmenu_path
Fix the uptodate logic (uptodate if !find newer dirs than the cache).
[dmenu.git] / dmenu_path
1 #!/bin/sh -f
2 CACHE=$HOME/.dmenu_cache
3 IFS=:
4
5 qfind() {
6         find "$@" 2>/dev/null
7 }
8
9 uptodate() {                                                                       
10         test -f $CACHE &&
11                 test "$(echo "$PATH")" = "$(sed 1q "$CACHE")" &&
12                 ! qfind $PATH -maxdepth 0 -newer $CACHE >/dev/null
13 }
14
15 if ! uptodate
16 then
17         {
18                 echo "$PATH"
19                 qfind $PATH -type f -maxdepth 1 '(' -perm -u+x -o -perm -g+x -o -perm -o+x ')' |
20                         sed 's,.*/,,' | sort | uniq
21         }
22         mv $CACHE.$pid $CACHE
23 fi
24
25 tail -n +2 $CACHE
26