Shell Script First Lesson

Source: Internet
Author: User

The file name of the shell script usually ends in. sh, or in other formats, such as. txt or even without a suffix. The #!/bin/bash of the first line of the script represents the parser that specifies when the script executes.
#!/bin/bash# file name: In addition to the first line of the well number represents the parser executed by the script # The rest of the notation indicates the comment echo "aaaaaaaaaaaaaaa" echo "bbbbbbbbbbbbbbbb" #echo " CCCCCCCCCCCCCCC "echo" DDDDDDDDDDDDDDDDD "

The newly created shell script does not have execute permissions, can be run through the Bash command, or you can change the permissions of the script after you use the./ to execute. Note./indicates the current path, do not use directly to try to execute the script, if not add the preceding./, the interpreter will go to the/bin directory to find instead of looking for in the current directory. And then it goes wrong.

When you use the Bash command to execute a shell script, you do not need to specify the parser in the script, and you do not need the script to have Execute permissions

When using./ to execute a shell script, you need to specify the parser in the script, and you need the script to have Execute permissions

Shell Script First Lesson

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: 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.