On Sun, Jul 24, 2011 at 10:00:09PM +0800, lolilolicon wrote:
> 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?
I usually reference opengroup for POSIX util specs. I do love the
wooledge wiki, though.
http://pubs.opengroup.org/onlinepubs/000095399/utilities/test.html
d
> 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:09:58 CEST
This archive was generated by hypermail 2.2.0 : Sun Jul 24 2011 - 16:12:06 CEST