mirror of
https://github.com/dunwu/linux-tutorial.git
synced 2024-04-15 19:55:24 +08:00
17 lines
240 B
Bash
17 lines
240 B
Bash
#!/bin/bash
|
|
# testing closing file descriptors
|
|
|
|
exec 3>test
|
|
echo "This is a test line of data" >&3
|
|
|
|
# closing file descriptor
|
|
exec 3>&-
|
|
|
|
echo "This won't work" >&3
|
|
|
|
cat test
|
|
|
|
#覆盖前一个test文件
|
|
exec 3>test
|
|
echo "This'll be bad" >&3
|