On Thursday 15 July 2004 01:51 pm, Chris Ess wrote:
> > > grep vpopmail /etc/passwd | awk -F ":" '{print $6}'
> > >
> > > or
> > >
> > > grep vpopmail /etc/passwd | cut -d':' -f6
> I would think that cut would be more portable.  However, every machine
> I've used has had some variant of awk installed too.

ok, my initial intent was to use cut, so I think I'll stick with that.

> You might want to consider using 'grep ^vpopmail' or even 'grep
> ^vpopmail:' rather than 'grep vpopmail' to ensure that you're only getting
> the 'vpopmail' user.

good catch.  Change made.  The beauty of the open source community is shown :)

> (I have a server in which we've had to transparently 
> migrate users who were set up under sendmail so we have users whose home
> directories are under the vpopmail directory.  Nasty, I know.)  The one
> catch is that I don't know if 'grep ^string' is supported in all versions
> of 'grep'.

POSIX regular expressions should be portable to any POSIX conforming unix 
variant.  I would think that any implementation of grep would be able to 
handle that simple regex.

> > also, while on the topic of portability, I noticed that djb does not
> > include ANY variable substitutions (only backtick ` ` substitutions) in
> > his Makefile. I'm curious if this is also for portability reasons. 
> > Anyone aware of any implementations of the 'make' program that don't
> > understand variable substitions in Makefiles, or any situations (lack of
> > /bin/sh compatible shell, perhaps?) that might make variable
> > substitutions not possible?
> I don't know of any portability concerns in this regard.  I wonder if this
> is just a design choice.

could be, although I know djb went to great lenghts to make his code as 
absolutely portable as possible, and I don't want to stray from this :)

Thanks Chris.


Jeremy Kitchen ++ Systems Administrator ++ Inter7 Internet Technologies, Inc.
  [EMAIL PROTECTED] ++ www.inter7.com ++ 866.528.3530 ++ 847.492.0470 int'l
        kitchen @ #qmail #gentoo on EFnet ++ scriptkitchen.com/qmail

Reply via email to