【发布时间】:2013-10-01 05:49:37
【问题描述】:
scriptlist=`ls $directory_/fallback_* 2> /dev/null`
命令中2> 部分的具体用途是什么?
我省略了它并运行了命令,它工作正常。
而且,如果 ls 的输出存储在 /dev/null 文件中,那么变量 scriptlist 将包含什么。
当我执行代码时,输出在变量中,而文件null 中没有任何内容。如果我们删除2,则输出在文件而不是变量中。
知道这行代码到底在做什么吗?
【问题讨论】:
-
${script} $* >> $logfile 2>&1 < /dev/null`2>&1 In the shell, what is “ 2>&1 ”?
标签: linux bash shell unix command-line-interface