I have a shell script that I currently use for some build related stuff for a mobile application.
Due to the the subtle differences between BSD & GNU one of build scripts originally written on a Mac (BSD)
environment=$1
if [[ -z $environment ]]; then
environment="beta"
fi
if ! [[ $environment =~ (live|beta) ]]; then
echo "Invalid environment: $environment"
exit 1
fi
mobile_app_api_url="https://api"$environment".mysite.com"
cp app/index.html.mob MobileApp/www/index.html
sed -i'' "s#MOBILE_APP_API_URL#\"$mobile_app_api_url\"#g" MobileApp/www/index.html
The sed command has been written on BSD (Mac) but as builds may take place on both Mac or Ubuntu (GNU) I need to modify this to work with on both flavours, what is the best approach for this?