Re: [dev] [dmenu] dmenu_run improvements

From: lolilolicon <lolilolicon_AT_gmail.com>
Date: Sun, 24 Jul 2011 22:00:09 +0800

On Sun, Jul 24, 2011 at 9:09 PM, Connor Lane Smith <cls_AT_lubutu.com> wrote:
> On 24 July 2011 06:34, Dave Reisner <d_AT_falconindy.com> wrote:
>> if [ "$path" -nt "$CACHE" ]; then
>
> 'test -nt' is non-portable. I think you've just discovered why we use
> the 'ls -dt' hack.
>
> I agree that dmenu_run isn't the nicest script in existence. But
> because of the tedious limitations of POSIX we don't have much choice.

Sorry, but can you give an example where `test -nt' is not available?
Or can you point out what do you refer to to determine the portability
of a shell script?

According to Greg's wiki [1], `test -nt' is not supported by dash,
although it works here with dash 0.5.6.1. Even if you must support the
older versions that does not know about `test -nt', you can use find:

  test `find "$path" -prune -newer "$CACHE"`

as a drop-in replacement, which is better than `ls -dt' after all.

[1] http://mywiki.wooledge.org/Bashism
Received on Sun Jul 24 2011 - 16:00:09 CEST

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