[Pkg-sysvinit-devel] Strange redirection in mountnfs.sh
Thomas Hood
jdthood at yahoo.co.uk
Thu Jan 5 12:15:59 UTC 2006
Henrique de Moraes Holschuh wrote:
> On Thu, 05 Jan 2006, Thomas Hood wrote:
>> exec 0>&1
>>
>> I don't understand this. Is it a mistake?
>
> Probably. It has no real effect if stdin and stdout are a tty, but if they
> aren't...
Presumably its purpose was to close /etc/fstab at that point in the script.
OK, I have changed the script now to eliminate the extra subshell invocation.
// Thomas
--- mountnfs.sh (revision 528)
+++ mountnfs.sh (working copy)
@@ -23,14 +23,13 @@
do_start() {
[ -f /etc/fstab ] || return
#
- # Run in a subshell because of I/O redirection.
- #
- (
- #
# Read through fstab line by line. If it is NFS, set the flag
# for mounting NFS file systems. If any NFS partition is found and it
# not mounted with the nolock option, we start the portmapper.
#
+
+ exec 9<&0 </etc/fstab
+
portmap=no
while read DEV MTPT FSTYPE OPTS REST
do
@@ -71,7 +70,9 @@
esac
fi
done
- exec 0>&1
+
+ exec 0<&9 9<&-
+
if [ "$portmap" = yes ]
then
if [ -x /sbin/portmap ] && [ -z "$(pidof portmap)" ]
@@ -121,7 +122,6 @@
fi
fi
fi
- ) < /etc/fstab
}
--
Thomas
More information about the Pkg-sysvinit-devel
mailing list