]> git.armaanb.net Git - dmenu.git/blob - dmenu_path
applied anydot's dmenu_path caching patch, thank you!
[dmenu.git] / dmenu_path
1 #!/bin/sh
2 CACHE=$HOME/.dmenu_cache
3 UPTODATE=1
4 IFS=:
5
6 if test ! -f $CACHE 
7 then
8         unset UPTODATE
9 fi
10
11 if test $UPTODATE
12 then
13         for dir in $PATH
14         do
15                 test $dir -nt $CACHE && unset UPTODATE
16         done
17 fi
18
19 if test ! $UPTODATE
20 then
21         for dir in $PATH
22         do
23                 for file in "$dir"/*
24                 do
25                         test -x "$file" && echo "${file##*/}"
26                 done
27         done | sort | uniq > $CACHE
28 fi
29
30 cat $CACHE