[! -Z "$ got_error"]; then = "$ (get_input" Do you wish to change the shell? (Y/n) ")" ["$ (echo $ getyn | grep-i" n ")"]; thenneedinputneedinput = "-s $ {SHL}"
#: Get the expiry date: # = yes [! -Z "$ needinput"]; do = "$ (get_input" Expiry date (YYYY-MM-DD) []: ")" [! -Z "$ EXP"]; then
# Check to see whether the expiry date is in the valid format [-z "$ (echo" $ EXP "| grep" ^ [[: digit:]] {4 } [-] ? [[: digit:]] {2 } [-] ? [[: digit:]] {2 } $ ")"]; then "- That is not a valid expiration date "needinput ="-e $ {EXP} "needinput
# Display the info about the new impending account "New account will be created as follows:" "-------------------- ------------------- "" Login name: "" $ LOGIN "" UID: "" $ _UID "" [Next available] "" Initial group: "" $ GID "" Additional groups: "" $ AGID "" [None] "" Home directory: "" $ HME "" Shell: " ; "$ SHL" "Expiry date:" "$ EXP" "[Never]"
"This is it ... if you want to bail out, hit Control-C. Otherwise, press "" ENTER to go ahead and make the account. "Junk
"Creating new account ..."
# Add the account to the system = "$ useradd" $ HME "-m" $ EXP "" $ U_ID "" $ GID "" $ AGID "" $ SHL "" $ LOGIN ""
$ CMD
[$? -Gt 0]; then "- Error running useradd command - account not created!" "(Cmd: $ CMD)" 1
# Set the finger information
$ chfn "$ LOGIN" [$? -Gt 0]; then "- Warning: an error occurred while setting finger information"
# Set a password
$ passwd "$ LOGIN" [$? -Gt 0]; then "* WARNING: An error occured while setting the password for" "this account. Please manually investigate this * "1
# If it was created (it should have been!), set the permissions for that user's dir = "$ (echo" $ HME "| awk '{print $ 2}')" ; # We have to remove the-g prefix [-d "$ HME"]; then
$ chmod $ defchmod "$ HME"
"Account setup complete." 0
ДОДАТОК Б
БЛОКСХЕМА алгоритмі ПРОГРАМИ