Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

gx.shell

作用

执行 shell 命令/脚本,可加载参数文件,可回填输出变量。

语法

gx.shell(
  shell: "<command or script>",
  arg_file: "<json|yml|yaml|toml|ini>",
  out_var: "<var name>",
  err: "<err var>",
  ok_codes: "0,2",
  log: "1|2|3",
  sudo: "true|false",
  silence: "true|false"
);

也支持匿名首参数:

gx.shell("./demo.sh");