1. 程式人生 > >jenkins 執行shell命令出錯command not found 和No such file or directory

jenkins 執行shell命令出錯command not found 和No such file or directory

image 圖片 分享圖片 root not found wid 腳本 local 成功

[root@localhost usr]# sh test.sh

command not found

[root@localhost ~]# cd usr
-bash: cd: usr: No such file or directory

這裏還碰到了一個問題,我用Xshell遠程登錄到服務器,直接可以執行我的一個腳本,這個腳本裏有一些命令是在PATH路徑下的。

但是在Jenkins裏面直接執行腳本卻報錯了,說是找不到這些命令,最後我在執行腳本前先export PATH = /home/....

把PATH設置了一下,結果就執行成功了,不知道為什麽 jenkins遠程登錄默認讀不到PATH.

技術分享圖片

jenkins 執行shell命令出錯command not found 和No such file or directory