[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] extdebug not providing expected results with declare -F
From: |
Michael Convey |
Subject: |
Re: [Help-bash] extdebug not providing expected results with declare -F |
Date: |
Sat, 25 Jul 2015 15:21:14 -0700 |
On Wed, Jul 22, 2015 at 8:16 AM, Chet Ramey <address@hidden> wrote:
>
> declare -F function-nam
> e
>
$ vi script
$ cat script
testfunc1 ()
{
ls -al
{
testfunc2 ()
{
pwd
}
$ source ./script
$ shopt extdebug
extdebug off
$ declare -F testfunc1
testfunc1
$ declare -F testfunc2
testfunc2
$ shopt -s extdebug
$ shopt extdebug
extdebug on
$ declare -F testfunc1
testfunc1 1 ./script
$ declare -F testfunc2
testfunc2 6 ./script
$ declare -F
...
declare -f testfunc1
declare -f testfunc2
$
Interesting, when I originally quoted the following:
"The -F option inhibits the display of function definitions; only the
function name and attributes are printed. If the extdebug shell option is
enabled using shopt, the source file name and line number where the
function is defined are displayed as well."
I just assumed 'declare F' without arguments would provide "the source file
name and line number where the function is defined" for all functions
listed. The man page could be more clear on this point. Maybe that is what
is implied by the line that follows the quote above:
"
The -F option implies -f.
"
Also interesting, is that the 'declare' command does not seem to accept
globs:
$ declare -F "t*"
$ declare -F t*
$
As I think about it, the functions are in RAM and not in the file system.
Is there a way to glob functions in RAM similar to what I'm attempting to
do above?