Re: [dev] [dmenu] dmenu_run improvements

From: lolilolicon <>
Date: Sun, 24 Jul 2011 18:41:30 +0800

On Sun, Jul 24, 2011 at 5:06 PM, Anselm R Garbe <> wrote:
> Nevertheless, I can see that script should be improved (not using the
> ls -dt invocation), but I prefer the back ticks (even if $(..) is
> POSIX, there were a couple of issues in the past that I barely
> remember) and I want explicit test calls, I don't like the [ ... ]
> syntax sugar.
> Thanks,
> Anselm

Fine, as long as it doesn't break anything, I can live with these two
Since I'm the thread starter, may I conclude this with the following?

        gen_cache() {
                lsx $PATH | LC_COLLATE=C sort -u > "$CACHE"
        if test -e "$CACHE"; then
                for path in $PATH; do
                        if test "$path" -nt "$CACHE"; then
                mkdir -p "${CACHE%/*}"
cmd=`dmenu "$@" < "$CACHE"` && eval exec "$cmd"

The (subshell) is used so the declarations won't get inherented, but
the user still has access to the $CACHE and $cmd environments.
Received on Sun Jul 24 2011 - 12:41:30 CEST

This archive was generated by hypermail 2.2.0 : Sun Jul 24 2011 - 12:48:03 CEST