I'm not entirely sure why I'm getting the error in my .bash_profile
syntax error near unexpected token `('
when I use the keyword grom()
for my function. I wanted to create a bash function that will just automatically rebase my master branch with origin
# git status
alias gs='git status'
# git stash list
alias gsl='git stash list'
grom() {
branch_name="$(git symbolic-ref --short -q HEAD)"
git fetch && git rebase origin/master && git checkout master && git rebase origin/master && git checkout $branch_name
}
# git stash apply. must append stash@{num}
alias gsa="git stash apply"
When I change the name of the function, it compiles fine. I couldn't find grom
as a keyword so I'm not sure what the issue is. If I rename the function to anything else like git-rom
or even something like groms
, it compiles fine. Is there some special keywords that do not work? This is on Mac OS X.
bash
, you may have better luck declaring it asfunction grom() { … }
. Another possibility is that there is an open-parenthesis in the output of your firstgit
command; trygit checkout "$branch_name"
as your last chained command, which may get you agit
error, but at least you'd know what needs fixing. (Sorry, I'm not yet agit
guru)function
in front. If you want to add that as an answer, I'd be willing to accept it. I'm still curious why it does this though. Thanks a lot!groms()
andgit-rom()
.set -x
to see what exactly is executed.