Minor bug in 4.58.9: check_mail:123 "echo -n" is not portable

Glenn Steen glenn.steen at gmail.com
Wed Feb 7 12:32:04 CET 2007


On 07/02/07, Tom G. Christensen <tgc at statsbiblioteket.dk> wrote:
> René Berber wrote:
> > Hi,
> >
> > As the subject says, the new version has a check_mail with line 123:
> >
> >   echo -n 'Starting MailScanner...'
> >
> > the problem is that "echo -n" does not work everywhere, specifically it doesn't
> > work in Solaris 9, 8, ... with the stock echo, or the built-in Bourne shell echo.
> >
> /usr/ucb/echo will do this on Solaris.
>
> $ /usr/bin/echo -n
> -n
> $ /usr/ucb/echo -n
> $
>
Exactly right... echo has _never_ been portable as such, due to there
being the two incarnations (BSD with -n etc, sysV with escape
sequences). So if one is to use it one has to test which version one
gets and act accordingly, or use something completely different (and
hope that that is a) present on all "dialects", b) more
portable...:-). If the aim is to use -n everywhere, and it is only
Solaris that is ... problematic, the test one should do is if this is
Solaris arch, and then use /usr/ucb equivalents (which are present on
every solaris back to at least 2.5 (my memory of SunOS earlier than
that has become more ... foggy... than I'd care to admit... Didn't one
have the sysV stuff in /usr/5bin back then? And the /usr/ucb thing
too?).
One could also _force_ /usr/ucb to be prepended to the PATH prior to
the call to echo, which would perhaps be the most elegant way of doing
things... Something like
if [ -d /usr/ucb ]
then
  PATH=/usr/ucb:$PATH
fi
... Since this would work on any arch/dialect/distro:-):-)

PS. Am I the only one still hating Sun for what they did when they
moved to Slolaris 5? IMO the only usable version is 10, where they
seem to have been influenced heavily by ... the competition:-). I
know, this arguement is dead and buried in ancient history.... Still,
that COSE thing really dampened my enthusiasm for the company and
their products... Still consider it every time we're out to buy new
stuff... Nah, I'm not bearing a grudge:-):-). And no Res, don't answer
that I'm the only one who remembers it:-D.

Cheers
-- 
-- Glenn
email: glenn < dot > steen < at > gmail < dot > com
work: glenn < dot > steen < at > ap1 < dot > se


More information about the MailScanner mailing list