Replace the contents of a file containing variable quantities of bulk linux sed to create a user and password

String loop replacement files, variables can be used

#!/bin/bash

list = "001 002 003 004 0005"

for i in $list 

do 

sed -i "s/hello/world/" think_${i}.conf

sed -i "s/wusi/student${i}/" think_${i}.conf

done


The following is the name given user created:
first of all gives the name given user, and individually created
for user in {u1, u2, u3, u4}; This code instructions given user name in {u1, u2, u3, u4 } this array; taken individually for loop

do
useradd $ // add the User given the User
echo "123456" | passwd $ --stdin the User; // Set Password
done

 

 

Published 172 original articles · won praise 45 · views 40000 +

Guess you like

Origin blog.csdn.net/fish_study_csdn/article/details/102663691