nocom: script that shows files without comments
This commit is contained in:
parent
91a2ae4a09
commit
215c5f73e2
|
@ -0,0 +1,32 @@
|
|||
#!/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
|
||||
|
Loading…
Reference in New Issue