gpt4 book ai didi

linux - 脚本有什么问题

转载 作者:太空宇宙 更新时间:2023-11-04 04:55:09 25 4
gpt4 key购买 nike

我的脚本在 Bash 中抛出错误:

/tmp/hudson6482258714933636361.sh: line 7: ((: i <=  : syntax error:operand expected (error token is "<=  ")
cp: cannot stat

‘/var/jenkins_home/jobs/Latha/jobs/ShirePoc/jobs/RetrieveJob/workspace/Deploy/retrieveUnpackaged/*’: No such file or directory

这是脚本:

COUNT= $(ls -1 | wc -l)
echo $COUNT
for (( i=1 ; i <= $COUNT ; i++ ));
do
var=package$i.xml
echo "FILENAME is $var"
mv -f $var package.xml
mkdir ${WORKSPACE}/Deploy/unpackaged
cp -R ${WORKSPACE}/tools/Package/package.xml ${WORKSPACE}/Deploy/unpackaged/
cd ${WORKSPACE}/Deploy/unpackaged
cat package.xml
ls -ltra
cd ${WORKSPACE}/Deploy/
ls -ltr
ant -buildfile build.xml RetrieveComponent
done

为什么脚本会导致错误?

最佳答案

我相信罪魁祸首是你的 COUNT 变量,将其更改为如下:

COUNT=$(ls -1 | wc -l)

似乎 =$ 之间有空格。请检查并告诉我们进展如何。

关于linux - 脚本有什么问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48942345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com