Why does the shell snippet
exec 5>file
echo foo >&5
echo bar >&5
cause repeated dup()ing and close()ing of the file descriptor instead of
a simple write() to the already open file descriptor, as pointed out in
[1]?
Looks like a simple optimization to avoid 2 of 3 syscalls (disclaimer: I
have not looked at the bash source code at all).
Regards,
Ralf
[1] http://lists.gnu.org/archive/html/bug-libtool/2005-05/msg00150.html
[Prev in Thread]
Current Thread
[Next in Thread]
optimization: do not repeatedly use dup(),
Ralf Wildenhues<=