linux - 运行通过ssh连接的远程计算机上的sh文件和运行本地的一样么?
天蓬老师
天蓬老师 2017-04-17 13:17:01
0
2
406

通过scp 将本地的sh文件上传到了 远程计算机
通过vim查看文件内容也没错 在本地运行也没错
但是在ssh连接远程计算机后,运行a.sh
提示command not found。。。。
[coffee@localhost stress]$ ls
stress-test-0.0.1-SNAPSHOT.jar stress-test-thread.sh
stress-test-2015-05-13.log stress-test-time.sh
[coffee@localhost stress]$ stress-test-thread.sh 100 check
-bash: stress-test-thread.sh: command not found
怎么回事啊?
谢谢

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
洪涛
  1. Direct execution of the script requires executable permission:
    Use ls -lrt to see if you have executable permissions. If not, add: chmod +x stress-test-thread.sh

  2. The way you use a.sh to execute is to search for the executable file a.sh in the global path. If your current path is no longer found in the environment variable of the global path, an error message will be reported. command not found;
    Several solutions:
    1) Use ./a.sh to execute the executable file in this directory;
    2) Add the current directory to the global path environment variable, or add a.sh to a global path like /bin/ (or add a symbolic link to this type of path)

  3. If the script does not have executable permissions, it can be executed in the following way:
    source a.sh
    . a.sh

黄舟

You need to change the stress-test-thread.sh of mode to executable.

$ chmod +x stress-test-thread.sh
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!