Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 1999 15:16:39 +0200
From:      Martin Cracauer <cracauer@cons.org>
To:        Bob Bishop <rb@gid.co.uk>
Cc:        Aaron Smith <aaron@mutex.org>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: New tests for test(1)
Message-ID:  <19990812151639.A17479@cons.org>
In-Reply-To: <l03020902b3d86d86439c@[194.32.164.2]>; from Bob Bishop on Thu, Aug 12, 1999 at 12:26:41PM %2B0000
References:  <37B2917A.6CBBC950@cdsec.com>; <37B2917A.6CBBC950@cdsec.com> <19990812040148.A13484@gelatinous.com> <l03020902b3d86d86439c@[194.32.164.2]>

next in thread | previous in thread | raw e-mail | index | archive | help
> >> thinking - wouldn't it be a good idea to add some new tests to test(1),
> >> to compare files based on criteria like size or modification date?

So far it has been policy for FreeBSD not to add options to
commandline utilities that are replaceable by simple shell script
constructs. Especially if that other construct is POSIX-compliant.

Examples:
- An option to date(1), which would print the machine's idea of the
  time, no matter what $TZ is set it. Easily replaceable by 
  (unset  TZ; date)
- An option to a tool that puts out a single line of text to stdout.
  The option would make it print its line without the final newline.
  Easily replaceable by backquotes
  echo `thistool`

Clearly, the functionality discussed falls into this category.

ls -t and head are specified in POSIX, thus it isn't affected by the
usualy shell script unportability like another poster implied.

> >this seems undesirable to me, since using it immediately makes your shell
> >scripts nonportable. i liked the ls -t suggestion though.
> 
> Further, isn't test a builtin for most (all?) shells? Sounds like a can of
> worms to me...

FreeBSD's /bin/sh uses the external /bin/test. Most other shells in
common use have it built in. You are right that this would confuse
people no end since most couldn't use the same test(1) arguments in
theirs scripts and interactivly.

In a word, I'm against it. Whatever you want this for, it's the far
better solution to have your own test(1)-like utility in your personal
search path.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/
BSD User Group Hamburg, Germany     http://www.bsdhh.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990812151639.A17479>