Useradd script problem
Hello,
I have a problem with my useradd-script. The script: Code:
#!/bin/bash Code:
user01 Code:
:/bin/sh1036::/home/user01 Code:
user01:x:1047:1047::/home/user01:/bin/sh Why is the result of the useradd in the script different? |
UPDATE:
lines in etc/passwd added by the script viewed with the command 'more etc/passwd' Code:
:/bin/sh1036::/home/user01 Code:
user01^M:x:1031:1031::/home/user01^M:/bin/sh Does anyone have a solution for this? |
UPDATE:
I changed the script-code: Code:
#!/bin/bash user01 user02 I gues without blank spaces. Now I need to get this value into the variable user, how do I do this? |
Did you write that script on a windows machine?
|
Try using "/usr/sbin/useradd" instead of useradd in the script.
cos crontab needs full path. |
I wrote the script in vi on a debian server (putty-session).
Thanks maxy7710, I changed the line. Code:
#!/bin/bash But when I want to fill the variable user it's empty. The echo $user shows two empty lines. How do I need to assign the variable? |
do user=`$line | head -c 6`
use " ` " key on left of numeric 1 u r issue will be solved |
also use /bin/echo in the script & try
|
Problem solved!
Code: Code:
#!/bin/bash With this code the user-line in the etc/passwd is correct. |
All times are GMT -5. The time now is 02:32 PM. |