LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


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.
Old

N00b method to toggle some verbosity on command for bash scripts

Posted 03-28-2016 at 11:32 PM by the dsc (linux-related notes)
Updated 03-28-2016 at 11:34 PM by the dsc
Tags bash, newbie

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.

Code:
if [[ $1 == "v" ]] ; then

ver(){
echo $@
}

else

ver(){
:    # ":" is a "do nothing" command
}

fi

a=10

echo normal output

ver verbose output $a
...
Member
Posted in Uncategorized
Views 1314 Comments 0 the dsc is offline

  



All times are GMT -5. The time now is 09:32 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration