#!/bin/bash
The read - p "Enter The Users Password:" PASSWD \
For UNAME ` in cat users. TXT `
Do
Id $UNANME & amp;>/dev/null
If [$? - eq 0]
Then
Echo "Already Exists"
The else
Useradd $UNAME & amp;>/dev/null
Echo "$PASSWD" | PASSWD -- stdin $UNAME & amp;>/dev/null
If [$? - eq 0]
Then
Echo "$UNAME is Create success", "
The else
Echo "$UNAME is Create failure"
Fi
Fi
The done
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
An error "haha. Sh: line 4: syntax error near unexpected token ` do '
"
CodePudding user response:
Feel there are other characters, such as ^ MCodePudding user response:
No ^ M: oh, I checked baidu many said the problem, but I don't have itCodePudding user response:
I copied can directly use this scriptCodePudding user response:
Users. TXT have? In the same directoryCodePudding user response:
Can answer technical points not? Without this file will be submitted to the wrongCodePudding user response:
You this script problem is very big, there is something wrong with the three places
I mark yellow rim boxer has a problem, you probably are copied, is probably caused by the format of the Windows and Linux different

I revised without any problems, manual, please rewrite the three judgment, don't copy, manual override, normally for, and if the two fields should be and then or echo the color of the field is the same, rather than the original color, you might be the problem of Windows copied
CodePudding user response: