在詹金斯进程中运行时,sed失败 [英] sed fails when running during jenkins process
问题描述
我正在运行一个在本地工作的脚本.但是当我在詹金斯构建过程中运行脚本时,sed无法正常工作.
I'm running a script that works locally. But when I run the script during our jenkins build process sed doesn't work.
这是我的验证路径正确的代码.文件在那里.
sed -i '' "s|$line|var bagVer = $PACKAGE_VERSION;|" "$PWD"
this is my code I verified the path is correct. The file is there.
sed -i '' "s|$line|var bagVer = $PACKAGE_VERSION;|" "$PWD"
sed: can't read s|var bagVer = "1.53.0";|var bagVer = \"1.58.0\";|: No such file or directory
我觉得这与我的语法有关.但这在本地有效,那么我该怎么办呢?
I feel like this has something to do with my syntax. But this works locally, so what could I be doing wrong?
推荐答案
从sed命令中删除-i
和两个单引号('
)之间的空格.通常,后缀必须紧跟在-i
选项之后,且不带空格.
Remove the SPACE between the -i
and the two single quotes ('
) from your sed command. Often, the suffix must immediately follow the -i
option with no spaces.
sed -i' ' "s|$line|var bagVer = \"$PACKAGE_VERSION\";|" "$PWD"
这篇关于在詹金斯进程中运行时,sed失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!