On Sun, Feb 9, 2020 at 10:26 AM Chet Ramey <chet.ramey(a)case.edu> wrote:
On 2/8/20 6:11 PM, Rob Pike wrote:
Not for me it doesn't.
% bash
bash-3.2$ function f() {
echo hi
}
bash-3.2$ export f
bash-3.2$ bash
bash-3.2$ f
bash-3.2$
jenna(1)$ echo $BASH_VERSION
5.0.11(6)-release
jenna(1)$ f() { echo f; }
jenna(1)$ export -f f
jenna(1)$ bash
jenna(2)$ f
f
jenna(2)$
It works the same in Mac OS X's bash-3.2.
I added the 'builtin' command, which
did leave the labs. But I added it
as
a way for the "whatis" command to show
a builtin, as well as allowing a
way
to guarantee you get the builtin on execution.
Bash uses `type' to tell whether something is a builtin. How does
`builtin'
say whether or not a command is builtin? The output with no arguments?
How do I get bash to print the function as
(shell) source code, so I
could
edit it and play with it again? It was the
synergy of all this stuff
connected seamlessly that made it so compelling.
jenna(2)$ declare -pf f
f ()
{
echo f
}
declare -fx f
If it weren't exported, you wouldn't get the `declare' command appended
there.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet(a)case.edu
http://tiswww.cwru.edu/~chet/