I've started working with a git repository that includes a large amount of content that should be assumed readonly.  So, every time I throw a new branch:git checkout -b newBranchit should be followed by the commandgit update-index --assume-unchanged LARGE_READONLY_DIRECTORYI figured this would be a perfect opportunity to try my fledgling bash skills, so that all I need to do at the shell is the first line, and it would execute that, then the second, without me remembering to do it (which I won't).I figured what I want to do is have a function in my .bashrc that checks whether the first argument is 'checkout', and the second it '-b'.  That first check is easy, but I can't figure out how to note the presence of -b.git() {    if [[ $1 == 'checkout' ]] && [[$2 == '-b']];             then echo 'yep!';    fi;    command git $@;}When I execute this, it complains that [[-b: command not found.  Presumably the fact that it's an option, rather than an argument, is important here.  Can anyone tell me how to check for the presence of that argument, so I know to execute the follow-up command?
How to extend a command in bash so that it expands based on options?
bash;shell script;git
You need a space between [[ and $2.For bash [[ is not syntax, it is a builtin command (or keyword to be precise). Bash will execute [[ with all its parameters, including the closing ]]. When you have no space between [[ and $2 bash will not see the keyword [[, instead it will see this thing: [[-b (after expanding $2 to -b). Bash will then try to execute the string [[-b as a command and fail. See help [[ for more information.For the same reason you also need a space before the closing ]].Here is your code fixed:git() {    if [[ $1 == 'checkout' ]] && [[ $2 == '-b' ]];             then echo 'yep!';    fi;    command git $@;}See also the bash pitfalls and the bash FAQ. IMO the best way to learn bash scripting... or the best way to learn not to do too much bash scripting.