Ubuntu – First Bash Script Problem

bashgitscripts

I'm completely new to Bash, and I'm trying to make a simple script to automate Git pulling and pushing from a repo, but I can't get it to work.

Here is a pastebin of the code: http://pastebin.com/JrXqktD4

#!/bin/bash
#Git Puller / Pusher for MobArenaBattles

echo "Please type whether you want to pull or push:"

read proc
cd $HOME/Desktop/IdeaProjects/Plugins/MobArenaBattles

if ["$proc"="push"]; then
  echo "Please type the commit message:"
  read message
  git status
  git add -A
  git commit -m $message
  git push
elif ["$proc"="pull"]; then
  git status
  git pull
else
  echo "Invalid choice! Exiting."
fi

The error I get is:

./MAB Git.sh: line 9: [push=push]: command not found
./MAB Git.sh: line 16: [push=pull]: command not found

I have tried using == and -eq but it comes up with the same error. Sorry if I'm being stupid, it's my first attempt.

Thanks in advance.

Best Answer

You need spaces:

if [ "$s1" == "$s2" ]
Related Question