xref: /netbsd-src/sbin/mount_portal/examples/sysctlfs.sh.sh (revision b75abedac4cde97d49b0cc16fbe175dca459b84d)
1#!/bin/sh
2## $NetBSD: sysctlfs.sh.sh,v 1.2 2003/07/26 19:46:33 salo Exp $
3##  Fast hack at a sysctl filesystem.  The path can be either in
4##  dot-style (kern.mbuf.msize) or in slash-style (kern/mbuf/msize).
5##  Hacked as an example by Brian Grayson (bgrayson@NetBSD.org) in Sep 1999.
6for path in $*; do
7  ##  First, change any slashes into dots.
8  path=`echo $path | tr '/' '.'`
9  ##  Now invoke sysctl, and post-process the output to make it
10  ##  friendlier.  In particular:
11  ##    1.  Remove the leading prefix.
12  ##    2.  Remove a now-leading ".", if any.
13  ##    3.  If we are left with " = <val>", strip out the " = " also.
14  sysctl $path | sed -e "s/$path//;s/^\.//;s/^ = //"
15done
16