Mac OS X 上复制和重命名文件的脚本失败
Script to copy and rename file fails on Mac OS X
我关注了这个问题:Provide xcodebuild with .mobileprovision file and used the script provided in the answer to try and copy .mobileprovision files into the directory, the only difference is I replaced the mParse dependency using grep, as per a suggestion in this link: https://gist.github.com/benvium/2568707
但是,当我 运行 这个脚本时,我得到以下错误:
$ sh installMobileProvisionFile.sh BuilderTestNew.mobileprovision
Found UUID 402a766e-bfc7-4f16-8ab6-a46a95361b00
copying to ~/Library/MobileDevice/Provisioning Profiles/402a766e-bfc7-4f16-8ab6-a46a95361b00.mobileprovision..
cp: ~/Library/MobileDevice/Provisioning Profiles/402a766e-bfc7-4f16-8ab6-a46a95361b00.mobileprovision: No such file or directory
done
如果我只是运行自己在脚本中执行的cp命令替换上述值的变量就可以正常工作,所以我不明白为什么在使用这个脚本时会失败?顺便说一句,我在 Yosemite。
编辑:
改编脚本如下:
if [ ! $# == 1 ]; then
echo "Usage: [=13=] (path/to/mobileprovision)"
exit
fi
mp=
uuid=`grep UUID -A1 -a ${mp}| grep -io "[-A-Z0-9]\{36\}"`
echo "Found UUID $uuid"
output="~/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"
echo "copying to $output.."
cp "${mp}" "$output"
echo "done"`
在Bash
中使用cp
命令时,您需要提供文件的完整路径。 ~/myFolder
之类的别名将不起作用。您需要提供完整路径,例如 /Users/Me/myFolder
.
我关注了这个问题:Provide xcodebuild with .mobileprovision file and used the script provided in the answer to try and copy .mobileprovision files into the directory, the only difference is I replaced the mParse dependency using grep, as per a suggestion in this link: https://gist.github.com/benvium/2568707
但是,当我 运行 这个脚本时,我得到以下错误:
$ sh installMobileProvisionFile.sh BuilderTestNew.mobileprovision
Found UUID 402a766e-bfc7-4f16-8ab6-a46a95361b00
copying to ~/Library/MobileDevice/Provisioning Profiles/402a766e-bfc7-4f16-8ab6-a46a95361b00.mobileprovision..
cp: ~/Library/MobileDevice/Provisioning Profiles/402a766e-bfc7-4f16-8ab6-a46a95361b00.mobileprovision: No such file or directory
done
如果我只是运行自己在脚本中执行的cp命令替换上述值的变量就可以正常工作,所以我不明白为什么在使用这个脚本时会失败?顺便说一句,我在 Yosemite。
编辑:
改编脚本如下:
if [ ! $# == 1 ]; then
echo "Usage: [=13=] (path/to/mobileprovision)"
exit
fi
mp=
uuid=`grep UUID -A1 -a ${mp}| grep -io "[-A-Z0-9]\{36\}"`
echo "Found UUID $uuid"
output="~/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"
echo "copying to $output.."
cp "${mp}" "$output"
echo "done"`
在Bash
中使用cp
命令时,您需要提供文件的完整路径。 ~/myFolder
之类的别名将不起作用。您需要提供完整路径,例如 /Users/Me/myFolder
.