SH, batch execution of Linux commands

Source: Internet
Author: User

Step 1: Create an SH batch command file
# vim/etc/batch_ssh/install_redis.sh


Step 2: To the current user, be able to execute SH script permissions
# chmod install_redis.sh 777


Step 3: Write the command to be executed in bulk, read to wait for the front-end user input, and sleep to indicate the wait time in seconds.

echo ' \ n begin to install plugin \ n '; yum install Cpp-y;echo ' \ n Yum finish install plugin \ n '; sleep 3; echo ' \ n begin to install plugin \ n '; yum install Binutils-y;echo ' \ n Yum finish install plugin \ n '; sleep 3; echo ' \ n begin to install plugin \ n '; yum install Glibc-kernheaders-y;echo ' \ n Yum finish install plugin \ n '; Sleep 3 ; echo ' \ n begin to install plugin \ n '; yum install Glibc-common-y;echo ' \ n Yum finish install plugin \ n '; sleep 3; echo ' \ n begin to install plugin \ n '; yum install Glibc-devel-y;echo ' \ n Yum finish install plugin \ n '; sleep 3; echo ' \ n begin to install plugin \ n '; yum install Gcc-y;echo ' \ n Yum finish install plugin \ n '; sleep 3; echo ' \ n begin to install plugin \ n '; yum install Make-y;echo ' \ n Yum finish install plugin \ n '; sleep 3; Echo ' all plugin had installed completed '; read;


Step 4: Finally, remember to save the file

#: Wq install_redis.sh


Step 5: Execute the Batch script file install_redis.sh
#/etc/batch_ssh/install_redis.sh
Or in the current directory, execute the
#./install_redis.sh



When all commands are completed, the following message is shown:

SH, batch execution of Linux commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.