我正在尝试配置jenkins作业,并将以下行添加到shell文本区域:
PATH="/home/${USER}/reportLogsComparator/";
RESULT_FILE="target/result.txt";
#remove previous results
cd ${PATH}
rm -f ${RESULT_FILE}
但结果是:
+ PATH=/home/build/reportLogsComparator/
+ RESULT_FILE=target/result.txt
+ cd /home/build/reportLogsComparator/
+ rm -f target/result.txt
/tmp/hudson6849808815020420288.sh: line 7: rm: command not found
另外,我尝试了
rm -f "$RESULT_FILE"
并且路径硬编码,但没有成功。
答案 0 :(得分:1)
PATH="/home/${USER}/reportLogsComparator/"
应该是
PATH="$PATH:/home/${USER}/reportLogsComparator"
这样,您可以将该目录附加到当前路径,而不是完全替换$ PATH。