2007/5/23, Anselm R. Garbe <arg_AT_suckless.org>:
>
> Thanks! I applied it to the repo, however I'm not totally sure
> the use of [ is a good idea. Is [ a symlink to test in any Unix?
>
> Regards,
> --
> Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
>
>
So, if functions are allowed then maybe even better can be this:
========
--- a/dmenu_path Wed May 23 13:22:27 2007 +0200
+++ b/dmenu_path Wed May 23 13:37:33 2007 +0200
@@ -1,22 +1,16 @@
#!/bin/sh
CACHE=$HOME/.dmenu_cache
-UPTODATE=1
IFS=:
-uptodate() { [ $UPTODATE -eq 1 ]; }
-
-if test ! -f $CACHE
-then
- UPTODATE=0
-fi
-
-if uptodate
-then
+uptodate() {
+ test ! -f $CACHE && return 1
for dir in $PATH
do
- test $dir -nt $CACHE && { UPTODATE=0; break; }
+ test $dir -nt $CACHE && return 1
done
-fi
+
+ return 0
+}
if ! uptodate
then
========
Which throws decision about cache freshnes to the uptodate() func.
--anydot
Received on Wed May 23 2007 - 13:43:03 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:42:22 UTC