]> git.armaanb.net Git - dmenu.git/blob - dmenu_path
I agree with the race fix of JG, but I dislike the SUSV3-breaking find, and I don...
[dmenu.git] / dmenu_path
1 #!/bin/sh
2 CACHE=$HOME/.dmenu_cache
3 IFS=:
4
5 uptodate() {
6         test ! -f $CACHE && return 1
7         for dir in $PATH
8         do
9                 test $dir -nt $CACHE && return 1
10         done
11         return 0
12 }
13
14 if ! uptodate
15 then
16         for dir in $PATH
17         do
18                 for file in "$dir"/*
19                 do
20                         test -x "$file" && echo "${file##*/}"
21                 done
22         done | sort | uniq > $CACHE.$$
23         mv $CACHE.$$ $CACHE
24 fi
25
26 cat $CACHE