Difference between 2>&-, 2>/dev/null, |&, &>/dev/null and >/dev/null 2>&1
2014-05-05 15:07
525 查看
Reference link: http://unix.stackexchange.com/questions/70963/difference-between-2-2-dev-null-dev-null-and-dev-null-21
up vote3down votefavorite 5 | Just looking for the difference between2>&- 2>/dev/null |& &>/dev/null >/dev/null 2>&1 and their portability with non-Bourne shellslike tcsh, mksh, etc. io-redirection tcsh file-descriptors bourne-shell
| ||||
|
2 Answers
activeoldestvotesup vote6down voteaccepted | For background: a number 1 = standard out (i.e. STDOUT) a number 2 = standard error (i.e. STDERR) if a number isn't explicitly given, then number 1 is assumed by the shell (bash) First let's tackle the function of these. For reference see the Advanced Bash-Scripting Guide. FunctionsThe general form of this one is |
相关文章推荐
- Difference between 2>&-, 2>/dev/null, |&, &>/dev/null and >/dev/null 2>&1
- 1>/dev/null and 2>/dev/null意义
- >/dev/null 2>&1
- Linux Shell 1>/dev/null 2>&1 含义
- >/dev/null 2>&1 与 2>&1 >/dev/null 的区别及使用技巧
- nohup 和>/dev/null 2>&1
- linux -- >/dev/null 2>&1
- 1>/dev/null 2>&1的含义
- /dev/null 2>&1 解释
- /dev/null 2>&1 详解
- Shell标准输出、标准错误 >/dev/null 2>&1
- linux脚本之>/dev/null 2>&1,以及2>1 VS 2>&1
- 【shell】/dev/null 2>&1
- > /dev/null 2>&1含义
- 详解shell中>/dev/null 2>&1到底是什么
- &>/dev/null 等价于 >/dev/null 2>&1
- 2> /dev/null的解释
- 再谈shell之“>/dev/null 2>&1”
- shell中使用>/dev/null 2>&1 丢弃信息
- shell脚本中/dev/null 2>&1详解