通过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
怎么回事啊?
谢谢
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
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)
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
ofmode
to executable.