Shell语法基础
cat < test1 标准输入ls -l > test1 标准输出
ls -l >> test1 追加
ls -l 2>test1 重定向标准错误
ls -l test test2 1>test5 2> test6重定向标准输出,标准错误
ls -l test &> test1 重定向标准错误和输出到同一个文件
echo "xx" > &2 将标准输出显示在标准错误的位置
exec 1 > test 将脚本中的标准输出重定向到test
0 < testfile
2 > test
########################################################
exec 3 > &1 把3重定向到标准输出
exec 1 > test14out把标准输出重定向到test14out
exec 1 > &3 把标准输出重定向到3
########################################################
exec 6 < &0 把stdin保存到6
exec 0 < test stdin重定向到test
exec 0 < &6 stdin恢复
########################################################
exec 3 > &- 关闭文件描述符
ls -al > /dev/null阻止命令输出
#######################################################
mktemp testing.XXXXXX 创建临时文件
mktemp -t test.XXXXXX 在tmp目录创建临时文件
mktemp -d dir.XXXXXX 创建临时目录
########################################################
date |tee testfile 将date输出到标准输出和testfile
页:
[1]