SyntaxFix
Write A Post
Hire A Developer
Questions
The following also works:
cd "${0%/*}"
The syntax is thoroughly described in this StackOverflow answer.