I'd like to create a simple script where I can easily create a new user, set them to a specific group, and set their password, all in one command.
something like
$ myscript newuser userpass
inside of "myscript" I'll just have pw useradd and etc.
The question is, how do I specify the arguments inside the script?
For instance, in a DOS batch file you'd use %1 for the first argument given. So inside the script you'd place %1 everywhere you want the first argument to be. What's the syntax for doing this in a shell script? I'm using csh, or bash, depending.
The second half of the question is, how can I pass the password to passwd so it doesn't ask. I thought maybe doing something like
echo newpass | passwd user
would work, but it does not.
I'm using a FreeBSD system, btw.
________
Remember, you're unique... just like everyone else.
something like
$ myscript newuser userpass
inside of "myscript" I'll just have pw useradd and etc.
The question is, how do I specify the arguments inside the script?
For instance, in a DOS batch file you'd use %1 for the first argument given. So inside the script you'd place %1 everywhere you want the first argument to be. What's the syntax for doing this in a shell script? I'm using csh, or bash, depending.
The second half of the question is, how can I pass the password to passwd so it doesn't ask. I thought maybe doing something like
echo newpass | passwd user
would work, but it does not.
I'm using a FreeBSD system, btw.
________
Remember, you're unique... just like everyone else.