In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Practice script
#! / bin/sh
#
# determine whether the file exists
#
Path=/etc/user.conf
If [!-f "$Path"]; then
Touch $Path
Fi
Chmod 644$ Path
# determine whether there are parameters
If [2-ne $#]; then
Echo "USER: sh adduser {- add |-del | search} username"
Exit 1
Fi
Age=$1
User=$2
If [0-lt $(echo "$User" | grep-E "[^ a Mizz User 0-9 User _]" | wc-l)]; then
Echo "The age format is error"
Exit 2
Fi
# find out whether the user exists
FunCheckUser () {
Check=$ (grep-w "$User" $Path | wc-l)
If [$check-eq 0]; then
Return 0
Else
Return 1
Fi
}
# add user
FunAddUser () {
FunCheckUser
If [$?-eq 0]; then
Echo "$User" > > $Path
Else
Echo "The user is having"
Exit 3
Fi
}
FunDelUser () {
FunCheckUser
If [$?-eq 0]; then
Echo "The $User no having"
Else
Sed-ri / ^ $User$/d $Path
Echo "The $User del"
Fi
}
# search whether a user exists
FunSearch () {
FunCheckUser
If [$?-eq 0]; then
Echo "NO user match"
Else
Echo "$User is having"
Fi
}
Case $Age in
-add)
FunAddUser
-del)
FunDelUser
Search)
FunSearch
*)
Echo "USER: sh adduser {- add |-del | search} username"
Esac
Note: grep-w exact match
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.