1. Write a script to determine what the IP of the current online user is (there are many methods) in the 10.0.0.0/24 network.
#!/bin/shfor N in ' seq 254 ' does ping-c1-w1 10.0.0. $n &>/dev/null If [$?-eq 0] then echo "10.0.0. $n is up ">>/tmp/uplist.log else echo" 10.0.0. $n are down ">>/tmp/downlist.log fidone
2. Batch Create 10 System account OLDBOY01-OLDBOY10 and set a password (password is a random 8-bit string).
#! /bin/bash. /etc/init.d/functions path=/server/scriptsuserdb= $Path/user.dbfaildb= $Path/fail_user.db [-D "$Path"] | | Mkdir-p $Path [-F "$UserDb"] | | Touch $UserDb [-F "$FailDb"] | | Touch $FailDb for N in $ (seq-w) do passwd= ' echo $ (date+%t%n) $RANDOM |md5sum|cut-c 2-9 ' useradd oldboy$n &G t;&/dev/null&& user_status=$? echo "$passwd" |passwd--stdinoldboy$n >&/dev/null && pass_status=$? If [$user _status-eq 0-a $pass _status-eq0];then action "AddUser oldboy$n"/bin/true echo-e "User:\toldboy$npas S: $passwd ">> $UserDb else action" AddUser oldboy$n "/bin/false echo-e" user:\toldboy$npass:$ passwd ">> $FailDb Fidone
Summary of the shell face questions