Sheel script!

First, the concept of Shell script
command · to be performed in order to save a text file
· executable permissions to the file, you can run
· Shell can be combined with various control statements to perform more complex operations
two, Shell scripting scenarios
· repetitive operations
· batch transaction processing
automated operation and maintenance
· service status monitoring
· regular tasks to perform
three constitute Shell script
1, script statement
2, annotations
2, executable statement

====================================================

if (judgment statement) of the shell

Shell Script Example:

[Root @ localhost ~] # vim liu.sh // shell scripts are generally easy to identify for the .sh

#! / Bin / bash // declare the resolver

<< EOF CAT
is available for purchase to Our Website!
EOF
       the Read -p "Please enter the correct user name:" the User
IF [$ the User = "Liuxiang"]; the then
       echo "user enters the correct"
       the Read -p "Enter Password:" password
IF [$ password = "lcx123"]; the then
       echo "login is successful, please collect your reward!"
the else
       echo "login failed":
fi
the else
       echo "invalid user"
fi

[Root @ localhost ~] #chmod + x liu.sh // add permissions to files Shell

[root @ localhost ~] # bash liu.sh // Run Shell Script
Welcome to our website!
Please enter the correct user name: liuxiang
user enters the correct
Please enter a user password: lcx123
successful login, please collect your reward!

===========================================================

 

Guess you like

Origin www.cnblogs.com/cxm123123form/p/11404787.html