Skip to content

Commit d65b3bf

Browse files
committed
Fix if statement
1 parent cf45b53 commit d65b3bf

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

git/branch_create.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ show_syntax() {
1111
if [[ "$1" ]];
1212
then
1313
BRANCH="master"
14-
if [ "$2" = "-b" ] && [ -n "$3" ];
14+
if [[ "$2" = "-b" ]];
1515
then
16-
BRANCH="$3"
17-
else
18-
echo "Missing third parameter!"
19-
show_syntax
16+
if [[ "$#" -ne 4 ]];
17+
then
18+
echo -e "$COLOR_RED"Missing third parameter, I use master branch!"$COLOR_WHITE"
19+
show_syntax
20+
else
21+
BRANCH="$3"
22+
fi;
2023
fi;
2124

2225
git checkout "$BRANCH"

0 commit comments

Comments
 (0)