cf75b0afc32c86480261032091dc2c2a76cedc24
[dmenu.git] / dmenu_run
1 #!/bin/sh
2 cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
3 if [ -d "$cachedir" ]; then
4         cache=$cachedir/dmenu_run
5 else
6         cache=$HOME/.dmenu_cache
7 fi
8 (
9         IFS=:
10         if [ "`ls -dt $PATH "$cache" | head -n 1`" != "$cache" ]; then
11                 lsx $PATH | sort -u | tee "$cache" | dmenu "$@"
12         else
13                 dmenu "$@" < "$cache"
14         fi
15 ) | read cmd && exec sh -c "$cmd"