Discussion:
Using file descriptor 4 in bash scripts
(too old to reply)
Angel Tsankov
2006-10-17 13:27:00 UTC
Permalink
May I safely use file descriptor 4 in a bash script?
Unruh
2006-10-17 15:24:05 UTC
Permalink
Post by Angel Tsankov
May I safely use file descriptor 4 in a bash script?
For what?
Bill Marcum
2006-10-17 15:19:19 UTC
Permalink
["Followup-To:" header set to comp.os.linux.misc.]
On Tue, 17 Oct 2006 16:27:00 +0300, Angel Tsankov
Post by Angel Tsankov
May I safely use file descriptor 4 in a bash script?
As far as I know, yes. How do you want to use it?
--
Bower's Law:
Talent goes where the action is.
Chris F.A. Johnson
2006-10-17 19:22:37 UTC
Permalink
Post by Angel Tsankov
May I safely use file descriptor 4 in a bash script?
Yes; the three descriptors in normal use are 0 (stdin), 1 (stdout),
and 2 (stderr).
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Angel Tsankov
2006-10-17 20:48:33 UTC
Permalink
Post by Chris F.A. Johnson
Post by Angel Tsankov
May I safely use file descriptor 4 in a bash script?
Yes; the three descriptors in normal use are 0 (stdin), 1
(stdout),
and 2 (stderr).
Does this mean that fd 4 (or fd 3) won't be used by bash and is
available to bash scripts?
Chris F.A. Johnson
2006-10-17 21:15:22 UTC
Permalink
Post by Angel Tsankov
Post by Chris F.A. Johnson
Post by Angel Tsankov
May I safely use file descriptor 4 in a bash script?
Yes; the three descriptors in normal use are 0 (stdin), 1
(stdout),
and 2 (stderr).
Does this mean that fd 4 (or fd 3) won't be used by bash and is
available to bash scripts?
That is correct.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Angel Tsankov
2006-10-17 21:34:31 UTC
Permalink
Post by Chris F.A. Johnson
Post by Angel Tsankov
Post by Chris F.A. Johnson
Post by Angel Tsankov
May I safely use file descriptor 4 in a bash script?
Yes; the three descriptors in normal use are 0 (stdin), 1
(stdout),
and 2 (stderr).
Does this mean that fd 4 (or fd 3) won't be used by bash and
is
available to bash scripts?
That is correct.
This is fine. Is it documented anywhere?
Chris F.A. Johnson
2006-10-17 22:28:44 UTC
Permalink
Post by Angel Tsankov
Post by Chris F.A. Johnson
Post by Angel Tsankov
Post by Chris F.A. Johnson
Post by Angel Tsankov
May I safely use file descriptor 4 in a bash script?
Yes; the three descriptors in normal use are 0 (stdin), 1
(stdout),
and 2 (stderr).
Does this mean that fd 4 (or fd 3) won't be used by bash and
is
available to bash scripts?
That is correct.
This is fine. Is it documented anywhere?
You can use any descriptor, even 0, 1, and 2. See the bash man page
for more information. See also the POSIX spec:
<http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_07>.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Bill Marcum
2006-10-23 18:46:48 UTC
Permalink
["Followup-To:" header set to comp.os.linux.misc.]
On Wed, 18 Oct 2006 00:34:31 +0300, Angel Tsankov
Post by Angel Tsankov
Post by Chris F.A. Johnson
Post by Angel Tsankov
Does this mean that fd 4 (or fd 3) won't be used by bash and
is
available to bash scripts?
That is correct.
This is fine. Is it documented anywhere?
I'm sure it would be documented if any file descriptor were not
available.
--
Nietzsche is pietzsche, but Schiller is killer, and Goethe is moethe.
Continue reading on narkive:
Loading...