Re: [EXIM] exicyclog problem

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Philip Hazel
Data:  
Para: Bruce Bowler
CC: exim-users
Assunto: Re: [EXIM] exicyclog problem
On Thu, 21 May 1998, Bruce Bowler wrote:

> a=`ls -lg $mainlog`
> b=`ls -l $mainlog`
> user=`echo "$a\n$b\n" | awk 'BEGIN { OFS=""} { if ($5 ~ /^[0-9]+$/) print
> $3; }'`
> group=`echo "$a\n$b\n" | awk 'BEGIN { OFS=""} { if ($5 ~ /^[0-9]+$/) print
> $4; )'`
>
> On my system, that results in
>
>    user=root\nroot
>    group=bin\nbin


Hmm. I'm guilty of assuming that everybody's /bin/sh is the same, I
suspect. I naively thought that *every* Unix system had the same
/bin/sh, namely the Bourne Shell. Sigh. I see that the command

echo "a\nb"

behaves differently in /bin/bash and /bin/sh or /bin/ksh. I surmise that
your /bin/sh is really /bin/bash. By experiment,

user=`echo "$a
$b
" | awk 'BEGIN { OFS=""} { if ($5 ~ /^[0-9]+$/) print $3; }'`
group=`echo "$a
$b
" | awk 'BEGIN { OFS=""} { if ($5 ~ /^[0-9]+$/) print $4; )'`

works in both /bin/sh and /bin/bash. I will change the script.

> Whilst I was poking around in there, I also noticed that the handy
> definitions of chown, chgrp, mv and rm aren't used everywhere they could
> be. That leads me to 2 questions...
>
> - Should they be used "everywhere" in exicyclog?


Yes, that's an oversight. Will fix.

> - Why are they there at all? What systems don't support chown, chgrp, mv
> and rm as commands that root can execute as part of a cron job (so I can
> make sure I never get one of those systems)?


There was some good reason concerned with the PATH in some operating
system, I seem to recall, but I can't remember the details.

-- 
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714



--
*** Exim information can be found at http://www.exim.org/ ***