Linux Execution Shell script

Source: Internet
Author: User

1. Create Shell script:/home/test.sh

cd/home/

Vim tesh.sh #linux不区分后缀,. SH is only for user convenience;

The first line of the test.sh file defines the format: #!/bin/bash indicates that the file is executed with the bash shell;

Content to write casually, for example: Fdisk-l | grep ' DISK/DEV/SDA ' | awk ' {print $} ' #显示sda分区的大小

2, the way of implementation:

A, relative path (need to give execute permission): chmod u+x test.sh

Cd/home

./test.sh

B. Under absolute path

/home/test.sh

C, use bash, sh to execute, do not need to give execution permission

Bash test.sh

SH test.sh

Linux Execution Shell script

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.