【发布时间】:2019-12-11 21:11:42
【问题描述】:
我可以像这样使用 nohup 存储 hive 查询的输出:
nohup hive -i transaction_testing.hive > nohup.out 2>&1 &
我的理解是 2>&1 将标准错误重定向到标准输出。
我的问题是,我是否也可以重定向标准,以便所有内容都在一个文件中?
A Google search shows me that in linux std in is 0.
我可以编辑上面的代码,在 nohup 文件中包含输入以及 std 错误吗?
例如假设 transactions_testing.hive 包含以下内容:
select *
from some_table
where fruits = 'apples';
我想在顶部输出包含此命令的文件以及下面的查询结果。
如果2>&1 将std 错误重定向到std out,0>&1 是否会对std in 做同样的事情?我如何将它们合二为一?
nohup hive -i transaction_testing.hive > nohup.out 0>1&2>&1 &
【问题讨论】:
-
一个通常重定向stdin(注意“in”=“input”)来自 /dev/null,
< /dev/null,虽然实际上不是,但实际上是关闭它。跨度>