In the Bash script, how does one close the file descriptor and encounter A problem when writing A Bash script tonight? this script is used to start A program B, which is called by another program, the result shows that many file descriptors opened by process A (such as Socket) exist in the newly started Process B ).... In the Bash script, how does one close the file descriptor and encounter A problem when writing A Bash script tonight? this script is used to start A program B, which is called by another program, the result shows that many file descriptors opened by process A (such as Socket) exist in the newly started Process B ). So I decided to close them in the script, because for the sake of simplicity, I used system () in program A to start the script. The script for disabling file descriptors is added as follows: www.2cto.com #! /Bin/sh cd $ (dirname "$0") | exit 1 exec 3> &-exec 4> &-. /rbtunnel "$ @" & # sleep 1 The key point here is to close the code of the file description: exec fd> &-or: exec fd <&-where fd is the number of the file descriptor, and the file descriptor can be viewed in Linux through lsof-c rbtunnel.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service