Running this through ShellCheck reports:
Line 2:
for i in `cat unix_tuesday.txt`
^-- SC1073: Couldn't parse this for loop. Fix to allow more checks.
Line 3:
password = "unixlab"
^-- SC1058: Expected 'do'.
^-- SC1072: Expected 'do'. Fix any mentioned problems and try again.
The password
assignment is in between the for
and the do
. Moving it to the beginning yields a new set of errors:
Line 2:
password = "unixlab"
^-- SC1068: Don't put spaces around the = in assignments.
Line 3:
for i in `cat unix_tuesday.txt`
^-- SC2013: To read lines rather than words, pipe/redirect to a 'while read' loop.
^-- SC2006: Use $(..) instead of legacy `..`.
Line 6:
adduser $i
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 7:
echo -e "$password" | passwd $password
^-- SC2039: In POSIX sh, echo flags are undefined.