Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
N00b method to toggle some verbosity on command for bash scripts
Just something I came up with that is probably not how actual programmers/scripters(?) would advise, specially the parameter/flag thing which is beside the point here.
Don't try replacing ":" with "true". Somehow that spawns an infinite number of the same scripts.
Code:
if [[ $1 == "v" ]] ; then ver(){ echo $@ } else ver(){ : # ":" is a "do nothing" command } fi a=10 echo normal output ver verbose output $a echo whatever man exit 0
Total Comments 0