1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA512 |
3 |
|
4 |
On 03/23/2013 01:44 PM, Alec Warner wrote: |
5 |
> On Sat, Mar 23, 2013 at 9:26 AM, Michał Górny <mgorny@g.o> |
6 |
> wrote: |
7 |
>> + # Close the lock file when we are done |
8 |
>> with it. + # Prevents deadlock if we aren't |
9 |
>> in a subshell. + eval "exec ${lock_fd}>&-" |
10 |
> |
11 |
> Not following this bit. |
12 |
> |
13 |
> The bash manpage says N>&DIGIT- redirects fd DIGIT to fd N. N may |
14 |
> be unspecified and defaults to 1. |
15 |
> |
16 |
> It doesn't say what happens if DIGIT is unspecified. Nor does it |
17 |
> say it closes any file descriptors. |
18 |
> |
19 |
|
20 |
The relevant section of bash(1) is reproduced below: |
21 |
|
22 |
Duplicating File Descriptors |
23 |
The redirection operator |
24 |
|
25 |
[n]<&word |
26 |
|
27 |
is used to duplicate input file descriptors. If word expands to |
28 |
one or more digits, the file descriptor denoted by n is made to |
29 |
be a copy of that file descriptor. If the digits in word do not |
30 |
specify a file descriptor open for input, a redirection error |
31 |
occurs. If word evaluates to -, file descriptor n is closed. |
32 |
If n is not specified, the standard input (file descriptor 0) is |
33 |
used. |
34 |
|
35 |
The operator |
36 |
|
37 |
[n]>&word |
38 |
|
39 |
is used similarly to duplicate output file descriptors. If n is |
40 |
not specified, the standard output (file descriptor 1) is used. |
41 |
If the digits in word do not specify a file descriptor open for |
42 |
output, a redirection error occurs. As a special case, if n is |
43 |
omitted, and word does not expand to one or more digits, the |
44 |
standard output and standard error are redirected as described |
45 |
previously. |
46 |
|
47 |
While the outcome of n>&- is not specified directly in the man page, |
48 |
it is treated exactly as n<&- is. |
49 |
|
50 |
- -- |
51 |
Jonathan Callen |
52 |
-----BEGIN PGP SIGNATURE----- |
53 |
Version: GnuPG v2.0.19 (GNU/Linux) |
54 |
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ |
55 |
|
56 |
iQIcBAEBCgAGBQJRTfsWAAoJELHSF2kinlg4MO0P+wTQovWzYdfSgUP8H4WFmO1y |
57 |
fpERqd1ZIoPle5Gl5+IUOWIHoMqkjS3mIAYUKF9cYwkufHRjbIs9l6NFGZg4wbRj |
58 |
baCW6dRTbnbaM/YSiHLlstb4I5fcSwldwhtJrMuO9O6qLq2IFupJYkaSLnYJMs6C |
59 |
HspU9W+bw4Vuvlk2wnhjGDGUj06ZIifQEOE6NYUVqF4GQaZlZpCsgA5BADPQL8zL |
60 |
RAb90dJuRIuPPwgzuFka1+h0z4Sg5xxSlV7FS4c+r+HzrZCHHIHSyi9lOpOPB/8M |
61 |
P+ZzJyDD3weW5AnAIuDjhJ3Rt0wI/2oYRRoVmC6hZ1CNSZuSjUCdWi6jvIvg99cR |
62 |
TscJ0dKBl7bMcrrIILcXYgHtyKC/QRZWp6r0JxqOwX4L7FbPhF3qbtano+TxoCSr |
63 |
X7hfCuRab1FEPE+jXeprH0c+N31SHrVBxfkJDG39MVx8hdJqXYzKCXah5/6lMJ63 |
64 |
Td2lc7Y3UBuXpxvQBoBCWTEV3vmKBrNX6v5Bu9TTLmrhfkcMsjCMX6TdU54tUoEU |
65 |
YE37njpI4Thsl24/LPQtzkR8v9fVyYqVvvXylSq5HcM48VlqlhcI/EP0SRo9eUXu |
66 |
CFRkwb7u5nX4YOdUMj+L0P59/N7Zobdfs/dCvGB4PDeJTqzFJowxVhm7Dh1Uxf6l |
67 |
a1CBWFm9+S7kUPDTfwV6 |
68 |
=tFvf |
69 |
-----END PGP SIGNATURE----- |