diff options
author | chris <chris@FreeBSD.org> | 2000-08-09 02:03:30 +0000 |
---|---|---|
committer | chris <chris@FreeBSD.org> | 2000-08-09 02:03:30 +0000 |
commit | ecf1cd2d1ce96875d4d7506f923cd86cf755257e (patch) | |
tree | 23b2fa12b4a7e1113bb312107384a4d3fdcfc30c | |
parent | 31d32eb7b17096bc631f7f00b1420754eac118b9 (diff) | |
download | FreeBSD-src-ecf1cd2d1ce96875d4d7506f923cd86cf755257e.zip FreeBSD-src-ecf1cd2d1ce96875d4d7506f923cd86cf755257e.tar.gz |
Use shell matching instead of sed(1) to strip comments and blank lines.
Since it doesn't depend on anything in /usr, it should work with a NFS-mounted
/usr partition.
Thanks to Bruce Evans to bringing this to my attention.
-rw-r--r-- | etc/rc.d/sysctl | 18 | ||||
-rw-r--r-- | etc/rc.sysctl | 18 |
2 files changed, 20 insertions, 16 deletions
diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl index 1a5c48e..7a852a3 100644 --- a/etc/rc.d/sysctl +++ b/etc/rc.d/sysctl @@ -3,14 +3,16 @@ # Read in /etc/sysctl.conf and set things accordingly # # $FreeBSD$ + if [ -f /etc/sysctl.conf ]; then - sed ' - /^[ ]*#/d - /^[ ]*$/d - s/#.*$//g - ' /etc/sysctl.conf | - while read var + while read var comments do - sysctl -w ${var} - done + case ${var} in + \#*|'') + ;; + *) + sysctl -w ${var} + ;; + esac + done < /etc/sysctl.conf fi diff --git a/etc/rc.sysctl b/etc/rc.sysctl index 1a5c48e..7a852a3 100644 --- a/etc/rc.sysctl +++ b/etc/rc.sysctl @@ -3,14 +3,16 @@ # Read in /etc/sysctl.conf and set things accordingly # # $FreeBSD$ + if [ -f /etc/sysctl.conf ]; then - sed ' - /^[ ]*#/d - /^[ ]*$/d - s/#.*$//g - ' /etc/sysctl.conf | - while read var + while read var comments do - sysctl -w ${var} - done + case ${var} in + \#*|'') + ;; + *) + sysctl -w ${var} + ;; + esac + done < /etc/sysctl.conf fi |