scripting, no-op statements in bash function (was: SATA hot swap)

Michael ODonnell michael.odonnell at comcast.net
Wed Jun 10 12:50:10 EDT 2009



> Two possibilities come to mind: grepping for ": funcName" and
> storing funcName in $_.  Grepping for ": funcName" might be an easy
> way to find where a function is defined if the source is spread
> out among many files and none of the files contain any comments.

Plausible, though that idiom isn't used consistently in the script
in question.

> [...]  If every function begins with ": funcName", $_ would instead
> hold the name of the function, as opposed to the name of the script.
> Depending on what "otherStuffHere" does, this information may be
> useful to the code that follows.

Also plausible, though bash defines $FUNCNAME inside every function.

> Also, if ":" was redefined to point to a debugging script, it
> would be called, with the function name as an argument each time
> a function is called.  Good for tracing, maybe?

Devious!  Sorta like bash's "functrace" option.

All your suggestions make sense considering that script mentions
dates that indicate development may have begun on it before bash
was widely used/available/stable.  Thanks.
 


More information about the gnhlug-discuss mailing list