Re: [PLUG] check for existing user

Tim Peeler on 2000年1月16日 10:40:33 -0500 (EST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] check for existing user


On 2000年1月16日, you wrote:
> I was thinking of just using the command id, but for either grep or id,
> how do I make a variable equal to true or false depending on what grep or
> another command returns? (in bash)
> 
> -- 
> Michelle Weber
> umweber@mcs.drexel.edu
Just use an if statement.
if (grep regexp foo 1>&2 > /dev/null) ; then
 var=true;
else
 var=false;
fi
Don't know if bash has something like c's conditional statements:
(grep regexp foo 1>&2>/dev/null) ? var=true : var=false;
But you could check.
______________________________________________________________________
Philadelphia Linux Users Group - http://plug.nothinbut.net
Announcements - http://lists.nothinbut.net/mail/listinfo/plug-announce
General Discussion - http://lists.nothinbut.net/mail/listinfo/plug



AltStyle によって変換されたページ (->オリジナル) /