I can, in principle, run any shell commands as mix tasks by defining aliases in mix.exs that start with cmd. But I am struggling with white spaces, quoting, and backslash escaping. Here is some non-working examples:
defp aliases do
  f1: ["cmd echo \"two  spaces  between\""],
  f2: ["cmd echo 'two  spaces  between'"],
  f3: ["cmd echo two\ \ spaces\ \ between"],
  f4: ["cmd echo two\\ \\ spaces\\ \\ between"],
end
They all just produce string "two spaces between", not what I expected or aimed for, "two  spaces  between":
$ for t in f1 f2 f3 f4; do mix $t; done
two spaces between
two spaces between
two spaces between
two spaces between
So how can I pass quoted strings to shell commands? And more generally, how is the alias cmd target processed before it is run by shell or is it executed directly? What's the logic of removing single and double quotes and backslashes from the command string?
Update: More failing cases:
  q1: ["cmd echo \"one  two  three\""],         # "one two three"
  q3: ["cmd echo \\\"one  two  three\\\""],     # "one two three"
  q5: ["cmd echo \\\\\"one  two  three\\\\\""], # "one" (!!!)
  f5: [
    """
    cmd echo 'two  spaces  between'
    """
      ],
Obviously, I would prefer being able to pass both kinds of quotes for the intended effect but there seems to be some undocumented, and in this context overaggressive and unnecessary sanitation of input string in operation.
I am running this with Elixir 1.11.1.
 
                        
Don't know if this is applicable to your situation, but when you define the tasks in local functions it seems to work better:
Output: