33 lines
574 B
Bash
33 lines
574 B
Bash
#!/bin/bash
|
|
|
|
usage (){
|
|
echo "Usage: nocom <filename>"
|
|
echo ""
|
|
echo "nocom simply removes all lines starting with '#'"
|
|
echo "and pipes it to less"
|
|
echo "nocom -h or nocom --help to view this again"
|
|
echo ""
|
|
echo "This script is in the public domain."
|
|
}
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "No filename provided"
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
while getopts ":h:" o; do
|
|
case "${o}" in
|
|
h)
|
|
usage
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
shift $((OPTIND-1))
|
|
|
|
sed -e 's:^\s*#.*$::g' -e '/^$/d' $1 | less
|
|
|