在脚本中加入source /etc/profile即可 如:ssh $i "source /etc/profile;/opt/module/zookeeper-3.4.10/bin/zkServer.sh stop"