Run your own shell script

Source: Internet
Author: User

Shell scripts can be directly./**.sh, or bash **.sh

I use the./**.sh to run a script of my own, and the following error will appear:

[Email protected]:~$./pixel. SH bash:. /pixel. SH : Insufficient permissions [email protected]: sudo ./pixel. SH [sudosudo:./pixel. sh: no command found

But running bash **.sh can.

./**.sh is the execution of the script as an executable and requires the chmod to change the permissions.

Save the above code as test.sh and CD to the appropriate directory:

+./test.  #使脚本具有执行权限./test.  #执行脚本      

Note that it must be written ./test.sh, not test.sh, run other binary programs also, write directly test.sh,linux system will go to the PATH to find there is no test.sh, and only/bin,/ Sbin,/usr/bin,/usr/sbin, etc. in path, your current directory is usually not in the path, so write test.sh will not find the command, to use./test.sh tells the system that it is looking in the current directory.

Run your own shell script

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.