Hylafax Mailing List Archives
|
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
Re: [hylafax-users] Caldera faxsetup problem with useradd
On Friday, September 08, 2000, at 10:14:00 PM, Lee Howard wrote:
> addPasswd()
> {
> if the output of 'useradd -v' is "useradd version 1.7" then
> set variable UA_OPT="" otherwise UA_OPT="-o"
> useradd -c 'Facsimile Agent' -d $4 -u $2 $UA_OPT -g $3 $1
> }
> (I'm not the best bash programmer, obviously. How would that above be coded?)
MATCHLEN=`expr \`useradd -v\` : "1\.7"`
[ $MATCHLEN -eq 3 ] && UA_OPT=-o
useradd -c bla bla $UA_OPT bla bla
It will default to null if you don't set it; zero length.
The trickery with expr(1) concerns regular expression matching; it's
subject to debugging at the keyboard; it's about 97% right. :-)
Cheers,
-- jra
--
Jay R. Ashworth jra@baylink.com
Member of the Technical Staff
The Suncoast Freenet
Tampa Bay, Florida http://baylink.pitas.com +1 727 804 5015
____________________ HylaFAX(tm) Users Mailing List _______________________
To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null