bash-scripting error on Microsoft AppCenter for pre-build script

会有一股神秘感。 提交于 2019-12-11 15:56:09

问题


I am having issues with the pre-build script on appcenter. Appcenter uses bash for the pre-build scripts. I want to change "qa.api" to "beta.api" in my api.js file.

I tried the following but it does not seem to work:

#!/usr/bin/env bash
if [ "$APPCENTER_BRANCH" != "master" ];
then
    cd App/Services/
    echo "changing QA API to Production API (beta)"
    sed -i 's/qa.api/beta.api/g' Api.js
fi

So I simplified it but it still does not work:

#!/usr/bin/env bash
cd App/Services/
sed -i 's/qa.api/beta.api/g' Api.js`

Any ideas?


回答1:


sed's -i option takes a parameter to indicate what extension to add to the file name when making a backup. Unlike linux versions, on macOS, this extension parameter is required.

Try to provide an empty string here: sed -i '' 's/qa.api/beta.api/g' Api.js



来源:https://stackoverflow.com/questions/51694801/bash-scripting-error-on-microsoft-appcenter-for-pre-build-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!