我需要编写一个 shell 脚本来安排每天运行以使用 mercurial 备份目录。我已经完成了大部分用例,除了我可以找到一种在脚本运行时进行自动登录的方法。
for REPOSITORY in $@
do
cd $REPOSITORY
# commit the changes
hg commit -A -m "Commit changes `date`"
# push the changes to the remote repository
if hg push
then
logger hg push success
else
logger hg push failure
fi
done
发出 hg push 命令后会显示登录提示。