Marco Education Week jobs

1. Create a user script:

#! / bin / bash
#
# ****************************************** **************************
#Author: zhangxinhua
# QQ: 303 525 359
#Date: 2020-04-05
#filename: createuser.sh
#URL : http://www.Idonthave.com
#description: the Test Script at The
#Copyright (C): 2020 All Rights Reserved
# *********************** *********************************************
the Read -p "Please enter your user name: "nAME
    IF the above mentioned id" $ nAME "&> / dev / null; the then
        echo" $ nAME the user at The exiting The "
elif
    [the -z $ nAME]; the then
        echo" Do not enter empty "; echo" Please again! execute the script "; Exit
the else
    useradd $ NAME; echo "123456" | passwd --stdin $ NAME &> / dev / null; id $ NAME; passwd -e $ NAME &> / dev / null; echo " initial password is set, the next time you log modify password "
fi

 

2. The initial installation custom scripts

#! / bin / bash
#
# ****************************************** **************************
#Author: zhangxinhua
# QQ: 303 525 359
#Date: 2020-04-05
#filename: reset.sh
#URL : http://www.Idonthave.com
#description: the Test Script at The
#Copyright (C): 2020 All Rights Reserved
# *********************** **********************************************

COLOR = "\ E [$ [. 7% + 31 is the RANDOM]; 1M "
the END =" \ E [0m "
echo -e" $ COLOR "Please select the desired option number
CAT << the EOF
. 1) variable is set PS1
2) installation Kit ( Tree, man-Pages, lrzsz)
. 3) defining an alias
4) provided IP
the EOF

Read -p "Please select input 1-4;" N
echo -e "$ the END"
case $N in
. 1)
    echo 'PS1 = "\ E [. 1; 32M [\ E [. 1; 35m \ U @ \ E [. 1; 36M \ H \ E [. 1; 35m \ W is \ E [. 1; 32M] \\ $ \ e [0m " '> /etc/profile.d/env.sh;echo" PS1 variable is set to complete, exit the current login user re-entry into force "
    ;;
2)
    yum the install -Y Tree; -Y man-yum Pages; yum - y install lrzsz; echo "installation is completed"
    ;;
. 3)
    echo "alias cdnet = 'CD / etc / sysconfig / Network-scripts'" >> ~ / .bashrc; echo "alias set successfully, the current exits the user to login the entry into force "
    ;;
4) echo" ip settings to be done! "
esac

Guess you like

Origin www.cnblogs.com/xinhua666/p/12640517.html