linux-tutorial/codes/shell/示例脚本/输入和输出/创建自己的重定向/创建输出文件描述符.sh

10 lines
205 B
Bash
Raw Normal View History

2019-05-10 11:17:57 +08:00
#!/bin/bash
# using an alternative file descriptor
2019-10-10 08:56:31 +08:00
exec 3> test
2019-05-10 11:17:57 +08:00
echo "This should display on the monitor"
echo "and this should be stored in the file" >&3
echo "Then this should be back on the monitor"