我一直在尝试向我的 bash shell 脚本添加一个选项,即有人执行“-r”我推送到 git 服务器但我收到以下错误
mirror.sh: line 8: conditional binary operator expected
mirror.sh: line 8: syntax error near `-e'
mirror.sh: line 8: `if [[ "$1" -e "-r" ]];then'
下面是我的 bash 脚本:
#!/bin/bash
cd /home/joe/Documents/sourcecode/mirror.git
git svn rebase
#
# if option -r then push to master
#
if [[ "$1" -e "-r" ]];then
git push origin master
fi