需要设置环境,bash文件的开头可以这么写 1 #!/bin/bash 2 . /etc/profile 3 . ~/.bash_profile 转载于:https://www.cnblogs.com/wanliyun/p/4913225.html