How to run the. sh file under Linux

Source: Internet
Author: User

How to run the. sh file under Linux

This article describes a method of how to run. sh files under Linux with commands, in two ways:

First, direct./plus file name. SH, if running hello.sh for./hello.sh "hello.sh must have x permission"

Second, direct sh plus filename. sh, such as Run hello.sh for SH hello.sh "hello.sh can have no x permission"

Tools/Materials
    • Windows, Linux
    • Xshell
Method One: The current directory executes the. sh file
    1. 1

      "Step One" CD to the directory where the. sh file is located

      For example, in the case of hello.sh files, such as

    2. 2

      "Step Two" Add x Execute permissions to the. sh file

      For example, take the hello.sh file as an example, chmod u+x hello.sh, such as

    3. 3

      "Step three"./execute. sh file

      For example, in the case of hello.sh files,./hello.sh can execute hello.sh files, such as

    4. 4

      "Step four" sh execute. sh file

      In the case of the hello.sh file, sh hello.sh can execute the hello.sh file, as

      END
Method Two: Absolute path execution. sh file
    1. 1

      The following three ways are available, such as

      ./home/test/shell/hello.sh

      /home/test/shell/hello.sh

      sh/home/test/shell/hello.sh

      END
Precautions
    • Use "./" To add the file name. SH Execute, must give. sh file plus x Execute permission
    • If you have the help, help "get", help you are our greatest motivation for progress!
    • If you like, please click "Vote", your participation is our greatest motivation for progress!
    • If you have questions, please submit a question, and your interaction is our greatest motivation for progress!
    • For reference only

How to run the. sh file under Linux

Related Article

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.