X-Git-Url: https://git.xinqibao.xyz/dmenu.git/blobdiff_plain/4042a11e5174633e9beeeec120937856e1d0f74f..63c9e30a7638a1e8e845fb32c9284f118b3102ed:/dmenu_path 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