> I've been given the task of writing a script that > automatically adds new client users on a new server > machine. Should be a no-brainer, right? I've been > writing stuff like that for 20 years. I wrote such a > script for our old BSD/OS system which is essentially a > wrapper around the adduser command. It has to do some > other things special to our needs, too, and is run by a > less-technical guy, which is why adduser is not used > directly. > > So now we need the same functionality on a new FreeBSD > system, and as I examine the thing I find: > > (a) FreeBSD adduser is not even remotely like adduser > in either BSD/OS or Linux. > > (b) FreeBSD adduser does not even accept a user *name* > option. > > (c) FreeBSD adduser does not read from stdin, so I > can't just say echo "newusername" | adduser -options... > In fact, when I try that, it goes into a wicked, > rapidly spinning loop that has to be killed. > > Surely there must be a canonical way to get where I'm > going from where I am, but I just don't know what it > is. Does anyone know what the key might be? I would think perl or expect should help with this situation. Expect is a wrapper program that can make interactive programs non-interactive. Or if adduser accepts input similar to adduser on linux (e.g. adduser options username) then have a shell script read in the desired username and then echo it into the command #!/bin/bash $USER=$1 `adduser $USER`