]> git.armaanb.net Git - dmenu.git/blob - dmenu_path
made dmenu_path the way anydot proposed in response to Jukka
[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 fi
24
25 cat $CACHE