X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=dmenu_path;h=d0a32c5ef2494295ea0405f3aa1ce27cbbffd057;hb=d058e835708d530d74f7e82d643f48d4ad62e3a4;hp=e590a5c835c5612fde380271b374d86cb80c15fc;hpb=4042a11e5174633e9beeeec120937856e1d0f74f;p=dmenu.git diff --git a/dmenu_path b/dmenu_path index e590a5c..d0a32c5 100755 --- a/dmenu_path +++ b/dmenu_path @@ -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