Linux的脚本需要放在/usr/local/bin目录下
[xiaoqiu@s150 /usr/local/bin]$ sudo touch xcall.sh
[sudo] password for xiaoqiu:
Sorry, try again.
[sudo] password for xiaoqiu:
[xiaoqiu@s150 /usr/local/bin]$ ll
total 0
lrwxrwxrwx. 1 root root 17 Dec 24 07:00 jps -> /soft/jdk/bin/jps
-rw-r--r--. 1 root root 0 Dec 24 15:34 xcall.sh
[xiaoqiu@s150 /usr/local/bin]
修改权限
lrwxrwxrwx. 1 root root 17 Dec 24 07:00 jps -> /soft/jdk/bin/jps
-rwxr-xr-x. 1 root root 23 Dec 24 15:36 xcall.sh
[xiaoqiu@s150 /usr/local/bin]$ xcall.sh
hello
for循环中要加空格
#!/bin/bash
i=150
params=$@
for ((i = 150 ; i <= 152 ; i = $i + 1 )) ; do
echo ====s$i =====
ssh s$i $params
done
shell脚本的空格问题
http://www.jb51.net/article/60327.htm