linux-tutorial/codes/shell/输入和输出/创建自己的重定向/从以重定向的文件描述符中恢复.sh
2019-10-29 18:22:19 +08:00

14 lines
209 B
Bash

#!/usr/bin/env 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"