从以重定向的文件描述符中恢复

5年以前  |  阅读数:469 次  |  编程语言:Shell 
#!/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"

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8