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

From: Ralf S. Engelschall <rse_at_FreeBSD.org>
Date: Wed, 23 May 2007 10:17:49 +0200
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
_at__at_ -48,7 +48,7 _at__at_
 [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
_at__at_ -60,7 +60,7 _at__at_
 [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
Received on Wed May 23 2007 - 06:35:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:10 UTC