etc/rc.d/{var,tmp} and sub-shell usage?!

Ralf S. Engelschall rse at FreeBSD.org
Wed May 23 08:35:59 UTC 2007


I've just stumbled over a confusing sub-shell usage in our
src/etc/rc.d/{var,tmp} scripts where I'm sure the sub-shells are totally
unnecessary and useless. I also do not see any difference under run-time
except that the sub-shell usage is slower, of course ;-)

Nevertheless, I'm a little bit curious whether someone else sees _ANY_
reason to keep those sub-shell constructs? If nobody has any objections
I would just cleanup these two scripts by removing the sub-shell
constructs...

Index: tmp
===================================================================
RCS file: /v/freebsd/cvs/src/etc/rc.d/tmp,v
retrieving revision 1.37
diff -u -d -r1.37 tmp
--- tmp	2 Dec 2005 20:35:23 -0000	1.37
+++ tmp	22 May 2007 14:18:48 -0000
@@ -48,7 +48,7 @@
 [Nn][Oo])
 	;;
 *)
-	if (/bin/mkdir -p /tmp/.diskless 2> /dev/null); then
+	if /bin/mkdir -p /tmp/.diskless 2> /dev/null; then
 		rmdir /tmp/.diskless
 	else
 		if [ -h /tmp ]; then
Index: var
===================================================================
RCS file: /v/freebsd/cvs/src/etc/rc.d/var,v
retrieving revision 1.42
diff -u -d -r1.42 var
--- var	2 Apr 2007 22:53:07 -0000	1.42
+++ var	22 May 2007 14:18:09 -0000
@@ -60,7 +60,7 @@
 [Nn][Oo])
 	;;
 *)
-	if (/bin/mkdir -p /var/.diskless 2> /dev/null); then
+	if /bin/mkdir -p /var/.diskless 2> /dev/null; then
 		rmdir /var/.diskless
 	else
 		mount_md ${varsize} /var "${varmfs_flags}"

--
rse at FreeBSD.org                        Ralf S. Engelschall
FreeBSD.org/~rse                       rse at engelschall.com
FreeBSD committer                      www.engelschall.com



More information about the freebsd-current mailing list