Re: Feature Request: Timestamp for when a function is defined (from a ye
From:
Stan Marsh
Subject:
Re: Feature Request: Timestamp for when a function is defined (from a year ago)
Date:
Wed, 18 Mar 2026 21:31:06 -0600
From: Chet Ramey
Subject: Re: Feature Request: Timestamp for when a function is defined
Date: Mon, 17 Mar 2025 10:13:18 -0400
On 3/15/25 5:28 PM, Stan Marsh wrote:
>> I implement a lot of things via (bash) shell functions. I keep them
>> stored in files in a directory called ~/bash_functions, and I have
>> code in .bash_aliases to load (i.e., source, aka "dot") every file in
>> that directory. I usually have lots of shells open in various windows
>> (and SSH sessions). It all works very well, except...
>To which Chet responded:
> If you want to, you can enable debugging mode and parse the output of
> declare -F for each function you're interested in, since that gives the
> function name, source file, and line number. There are several ways to
> generate function names -- `compgen -A function' is probably easiest to
> work with.
I finally got around to testing this and the output of "declare -F <fun>"
does look interesting and possibly useful. This looks like at least
the beginning of the framework for the kind of thing I'm looking for.
And thus a couple of questions come to mind:
1) Could a timestamp (i.e., a field of type time_t) be added to
this data structure? Of course, the answer is "Yes"; it should
not be too difficult.
2) How much overhead is added by doing "shopt -s extdebug" (which
is necessary in order for the output of "declare -F <fun>" to be
at all useful) in one's day-to-day scripting?
=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.
When responding to my posts, please try to refrain from giving bureaucratic
answers.
If you have nothing useful to say, then just click Next and go on.