Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!samsung!uunet!mcsun!ukc!yorkohm!pete From: pete@ohm.york.ac.uk (-Pete French.) Newsgroups: alt.hackers Subject: Re: hmm Message-ID: <1991Jun28.143407.20485@ohm.york.ac.uk> Date: 28 Jun 91 14:34:07 GMT Organization: Electronics Department, University of York, UK Lines: 20 Approved: pete@ohm.york.ac.uk in article , bbs.dixie@spies.com (Dixie Flatline) says: > Approved: news@rutgers.rutgers.edu > > How would one add a line to crontabs to add a user with root privs to th e > /etc/passwd file IF there was not one by that name already exsisting? > I mean I know how to get it to add the line to etc/passwd, but how would you > get that IF clause in there? cron executes the commands with a boune shell - just stick an "if" in there. The test for the if whould be a simple "egrep" for a user with 0 as the uid should be easy enoigh to write something along the lines of... egrep "^[a-zA-Z]*:0:" -bat. -- -Pete French. (the -bat. ) / "Two wrongs don't make a right, Adaptive Systems Engineering / - but three lefts do !" "Look here, a Brit who has obviously been driving in California!"