X-Git-Url: https://git.xinqibao.xyz/dmenu.git/blobdiff_plain/68a24f5535030473e90426c30fafe75262add419..a662fc6e0abeacb64b5b37cedccaeee782f9454e:/dmenu_path?ds=sidebyside diff --git a/dmenu_path b/dmenu_path index 72ff3ed..59fe64d 100755 --- a/dmenu_path +++ b/dmenu_path @@ -1,2 +1,9 @@ #!/bin/sh -/bin/ls -lL `echo $PATH | tr : ' '` 2> /dev/null | awk '$1 ~ /^[^d].*x/ { print $NF }' | sort | uniq +CACHE=$HOME/.dmenu_cache +IFS=: + +if ! test -f "$CACHE" || find $PATH -type d -newer "$CACHE" | grep -q .; then + find -L $PATH -type f \( -perm -1 -o -perm -10 -o -perm -100 \) | sed 's/.*\///' | sort -u > "$CACHE" +fi + +cat "$CACHE"