]> git.armaanb.net Git - dmenu.git/blobdiff - dmenu_path
Added tag 3.5 for changeset 05e5bd706b3b
[dmenu.git] / dmenu_path
index e590a5c835c5612fde380271b374d86cb80c15fc..d0a32c5ef2494295ea0405f3aa1ce27cbbffd057 100755 (executable)
@@ -1,22 +1,17 @@
 #!/bin/sh
 CACHE=$HOME/.dmenu_cache
-UPTODATE=1
 IFS=:
 
-if test ! -f $CACHE 
-then
-       unset UPTODATE
-fi
-
-if test $UPTODATE
-then
+uptodate() {
+       test ! -f $CACHE && return 1
        for dir in $PATH
        do
-               test $dir -nt $CACHE && unset UPTODATE
+               test $dir -nt $CACHE && return 1
        done
-fi
+       return 0
+}
 
-if test ! $UPTODATE
+if ! uptodate
 then
        for dir in $PATH
        do
@@ -24,7 +19,8 @@ then
                do
                        test -x "$file" && echo "${file##*/}"
                done
-       done | sort | uniq > $CACHE
+       done | sort | uniq > $CACHE.$$
+       mv $CACHE.$$ $CACHE
 fi
 
 cat $CACHE