#! /bin/sh # showsysfs: Display /sys attributes showpathnames="" bold="" b="" n="" while [ $# -gt 0 ]; do case "$1" in -b) # show attribute values in bold b=`tput bold` n=`tput sgr0` ;; -p) # Show pathnames showpathnames=1 ;; *) break ;; esac shift done dirs="$*" dirs=${dirs:=/sys} for dir in $dirs; do find "$dir" -print0 2>/dev/null | if [ "$showpathnames" ]; then xargs -n1 -0 grep '.' /dev/null 2>/dev/null else xargs -n1 -t -0 grep '.' /dev/null 2>&1 | sed -e 's,grep . /dev/null ,,' -e 's,[^/]*/,| ,g' \ -e 's,\([^ /|]\),\\- \1,' fi | sed "s/:\(.*\)/: $b\1$n/" done