On 24 July 2011 09:57, lolilolicon <loliloli...@gmail.com> wrote: > On Sun, Jul 24, 2011 at 4:39 PM, Anselm R Garbe <garb...@gmail.com> wrote: >> On 24 July 2011 06:34, Dave Reisner <d...@falconindy.com> wrote: >>> #!/bin/sh >>> >>> CACHE=${XDG_CACHE_HOME:-"$HOME/.cache"}/dmenu_run >>> IFS=: >>> LC_COLLLATE=C >>> >>> gencache() { >>> lsx $PATH | sort -u >"$CACHE" >>> } >>> >>> if [ ! -e "$CACHE" ]; then >>> mkdir -p "${CACHE%/*}" >>> gencache >>> fi >>> >>> for path in $PATH; do >>> if [ "$path" -nt "$CACHE" ]; then >>> gencache >>> break >>> fi >>> done >> >> Am I right that the previous loop runs gencache n times, under the >> assumption that each path component contains newer files? >> >> Kind regards, >> Anselm > > No, note the `break'.
True, I must have been half asleep when I glanced at that loop... 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