Rails: rake task with arguments not working

rake, rake-task, ruby-on-rails, zsh

Solution

You need to escape the square brackets when using them in some shells like zsh:

rake users:change_role\["role"\]

Problem

Here is my rake task ``` namespace :users do task :change_role, [:role] => :environment do |t, args| puts args.role end end ``` I am calling it like this: `rake users:change_role["role"]` but I am getting this error `no matches found: users:change_role["role"]`

Original source