Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.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
Shell 如何实现2>&;朱莉娅1号_Shell_Julia - Fatal编程技术网

Shell 如何实现2>&;朱莉娅1号

Shell 如何实现2>&;朱莉娅1号,shell,julia,Shell,Julia,假设我有命令 `echo hello` 现在,我想将它的STDOUT和STDERR重定向到一个流,这样它就像bash中的2>&1。我看到了两个关于Julia的问题,但仍然不明白Julia v.0.4应该如何运作 请参阅管道的帮助,特别是: run(pipeline(`echo hello`, stdout=STDOUT, stderr=STDOUT)) 将两者重定向到同一个流(进程STDOUT)。这也可能是其他原因 以下是您可以从REPL获得的帮助: help?> pipeline

假设我有命令

`echo hello`
现在,我想将它的STDOUT和STDERR重定向到一个流,这样它就像bash中的
2>&1
。我看到了两个关于Julia的问题,但仍然不明白Julia v.0.4应该如何运作


请参阅管道的帮助,特别是:

run(pipeline(`echo hello`, stdout=STDOUT, stderr=STDOUT))
将两者重定向到同一个流(进程
STDOUT
)。这也可能是其他原因

以下是您可以从REPL获得的帮助:

help?> pipeline
search: pipeline

  pipeline(command; stdin, stdout, stderr, append=false)

  Redirect I/O to or from the given command. Keyword arguments specify which
  of the command's streams should be redirected. append controls whether file
  output appends to the file. This is a more general version of the 2-argument
  pipeline function. pipeline(from, to) is equivalent to pipeline(from,
  stdout=to) when from is a command, and to pipeline(to, stdin=from) when from
  is another kind of data source.

  Examples:

  run(pipeline(`dothings`, stdout="out.txt", stderr="errs.txt"))
  run(pipeline(`update`, stdout="log.txt", append=true))

  pipeline(from, to, ...)

  Create a pipeline from a data source to a destination. The source and
  destination can be commands, I/O streams, strings, or results of other
  pipeline calls. At least one argument must be a command. Strings refer to
  filenames. When called with more than two arguments, they are chained
  together from left to right. For example pipeline(a,b,c) is equivalent to
  pipeline(pipeline(a,b),c). This provides a more concise way to specify
  multi-stage pipelines.

  Examples:

  run(pipeline(`ls`, `grep xyz`))
  run(pipeline(`ls`, "out.txt"))
  run(pipeline("out.txt", `grep xyz`))

此外,您应该升级到至少0.5。0.4不再受支持,0.6不久将发布。

您是如何从REPL获得帮助的?在REPL提示符下键入
。查看。Julia宏用于同时抑制和/或捕获输出(STDOUT)、警告(STDERR)或两个流