Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Elixir 作为混合别名运行shell脚本_Elixir_Elixir Mix - Fatal编程技术网

Elixir 作为混合别名运行shell脚本

Elixir 作为混合别名运行shell脚本,elixir,elixir-mix,Elixir,Elixir Mix,如何将shell脚本作为混合别名运行 我尝试了以下方法,但没有成功: defp aliases() do [ "test": [ "./scripts/test.sh" ] ] end defp aliases() do [ "test": [ "scripts/test.sh" ] ] end 每个返回值的变化如下: **(Mix)找不到任务“/scripts/test”您可以为此调用Mix.Tasks.Cmd任务: "test": ["cmd ./scri

如何将shell脚本作为混合别名运行

我尝试了以下方法,但没有成功:

defp aliases() do
  [
    "test": [ "./scripts/test.sh" ]
  ]
end

defp aliases() do
  [
    "test": [ "scripts/test.sh" ]
  ]
end
每个返回值的变化如下:


**(Mix)找不到任务“/scripts/test”

您可以为此调用
Mix.Tasks.Cmd
任务:

"test": ["cmd ./scripts/test.sh"]

这看起来是正确的答案。唯一的问题是,当在伞式应用程序中使用时,它是递归的。这意味着它将在每个子应用程序中运行该命令。如果脚本要在整个项目范围内执行某些操作,那么这可能是不可行的。不幸的是,我没有看到其他命令。
$ cat a.sh
#!/bin/bash
echo foo
$ cat mix.exs | grep test
      "test": ["cmd ./a.sh", "cmd echo bar"]
$ mix test
foo
bar