What are the points in front of./run. Sh used?

Source: Internet
Author: User

When bash executes a program, it only looks for it from the path. If the program is not in the path, the specific path must be provided ,. /run. the dot before sh indicates the current directory.

Several forms of bash calling programs:

1. In Path, directly call: Run. Sh

2. if the path is not in the path, the complete path:/tmp/run. Sh is provided.

3. If it is not in the path, the relative path:./run. Sh is provided.

4. If it is not in path, pass the program as a parameter to Bash: Sh run. Sh

[Root @ rhel6-server TMP] # pwd
/Tmp
[Root @ rhel6-server TMP] # Cat run. Sh

Echo "Hello world! "
[Root @ rhel6-server TMP] # ll
Total 4
-Rwxr-XR-X. 1 Root 20 Feb 28 00:20 run. Sh
[Root @ rhel6-server TMP] # env | grep path
Path =/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin: /usr/bin:/root/bin
[Root @ rhel6-server TMP] # Run. Sh
-Bash: Run. sh: Command not found
[Root @ rhel6-server TMP] #/tmp/run. Sh
Hello world!
[Root @ rhel6-server TMP] #./run. Sh
Hello world!
[Root @ rhel6-server TMP] # sh run. Sh
Hello world!
[Root @ rhel6-server tmp] # Path =.: $ path
[Root @ rhel6-server TMP] # env | grep path
Path =. :/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin: /root/bin
[Root @ rhel6-server TMP] # Run. Sh
Hello world!
[Root @ rhel6-server TMP] #

Ref: http://linux.vbird.org/linux_basic/0210filepermission.php#dir_path

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.