linux-tutorial/codes/shell/示例脚本/输入和输出/创建自己的重定向/从以重定向的文件描述符中恢复.sh
2019-05-10 11:17:57 +08:00

14 lines
200 B
Bash

#!/bin/bash
#storing STDOUT, then coming back to it
exec 3>&1
exec 1>test
echo "This should store in output file"
echo "along with this line"
exec 1>&3
echo "Now things should be back to normal"