As Ook mentioned, $() can resolve the issue. However, one of the reasons why it's not working in your example is that [ ] brackets must be space-separated from everything around them. In your example the ] bracket is attached to the ) bracket.