11.1Sbgrayson#!/bin/sh
21.2Ssalo## $NetBSD: sysctlfs.sh.sh,v 1.2 2003/07/26 19:46:33 salo Exp $
31.1Sbgrayson##  Fast hack at a sysctl filesystem.  The path can be either in
41.1Sbgrayson##  dot-style (kern.mbuf.msize) or in slash-style (kern/mbuf/msize).
51.2Ssalo##  Hacked as an example by Brian Grayson (bgrayson@NetBSD.org) in Sep 1999.
61.1Sbgraysonfor path in $*; do
71.1Sbgrayson  ##  First, change any slashes into dots.
81.1Sbgrayson  path=`echo $path | tr '/' '.'`
91.1Sbgrayson  ##  Now invoke sysctl, and post-process the output to make it
101.1Sbgrayson  ##  friendlier.  In particular:
111.1Sbgrayson  ##    1.  Remove the leading prefix.
121.1Sbgrayson  ##    2.  Remove a now-leading ".", if any.
131.1Sbgrayson  ##    3.  If we are left with " = <val>", strip out the " = " also.
141.1Sbgrayson  sysctl $path | sed -e "s/$path//;s/^\.//;s/^ = //"
151.1Sbgraysondone
16