Adduser Script Not Working .. Can Any 1 Tell Me Why?
#!/bin/bash
i=$1 a=$3001 while (( i=001 ; i<= 400 = user ;a= 3001 ; a <= 3400 ; = UID)) do echo useradd -p "123" -m -f 28 -G 9999 -u $a user{$i} Done |
Quote:
1. You should make all posts on the same subject in the same thread 2. No offense, but this script is so horribly wrong, it's kindof difficult to tell you what exactly is wrong... it's all wrong. Take a look here: http://tldp.org/LDP/abs/html/loops1.html#EX25 edit: ok, to give you a little pointer, take a look at this: Code:
#!/bin/bash |
I see numerous problems. I think it will be better if you tell us what the script is supposed to do.
For example, what did you intend with these two lines??: Quote:
|
I see from your other post that this is homework. You probably should post back after looking at the link BrianK gave you
|
Quote:
|
If you don't respond to help already given, you are not going to get very far here. Did you look at the link BrianK gave you?
Can you answer my earlier questions? What text do you use for BASH scripting? |
Quote:
simply replace echo $i $a with useradd -u $i ....and so on. from the man pages: Code:
useradd [-c comment] [-d home_dir] |
Its amusing how its so easy for you guys an for me I hardly know what im doing but BrianK I cam eup with this ....
#!/bin/bash i=1 a=3001 while [ "$i" -lt 400 ] do useradd -u $i -p "123" -m -f28 -G 9999 $a echo $i $a i=$(($i+1)) a=$(($a+1)) done exit |
oh yeah an dere is anoder problem also user name has to have 001 all the way to 400... an I think this will give me 1 to 399... not 400 but thats ok because I can create the 400th manually...
|
do any of you use MSN ? it would make it faster for me .. an easier to talk .. because Iv realised Ill be needing Yall ALOT !
|
Hey brianK its late here I have to leave from college so Ill be back from Home now ,, an try an do the script so i wont reply till I get home. Thanks alot you guys ! :)
|
Quote:
also, other than confirmation, there's no reason to echo out $i & $a, though leaving it in there for the time being can help you see what's going on. All this said, I don't remember the initial problem from the other thread, and, to be honest, don't feel like tracking it down, so either repost it here, or let's all continue over there. your choice. |
here is what i needed ,, what i wrote in the previous post....
I need a script to create 400 users with username starting from 001 all the way to 400 like user001 all the way to user400. They have to have UID 3001 to 3400 and all shud be in GID 9999. home directories should be /home/user001 all the way to /home/user400 and have a password expiery of 28 days. I am passign 9999 to G because all the users have to be assigned ot the group 9999. The m I suppose is to make a home directory for the user? $a is the UID not group.... |
if i want every user to be added with a home directory should i be using -d and not -m?
|
If you read the manpage, it says -d is to NAME the home dir, but you need -m to ensure it will be CREATED if it doesn't already exist.
HTH |
All times are GMT -5. The time now is 10:34 AM. |