1

What is FreeBSD's /bin/sh equivalent to bash's:

compgen -A function

which lists the names of the declared functions.

Ole Tange
  • 35,514
  • Don't put multiple questions into a single question. Anyway, that is already answered at https://unix.stackexchange.com/questions/322035/ and https://unix.stackexchange.com/questions/145522/ . – JdeBP Nov 23 '17 at 23:46

1 Answers1

2

FreeBSD's /bin/sh is the Almquist shell, and it has no equivalent to that because the Almquist shell does not have programmable command completion in the first place.

However, if you were looking for an equivalent for typeset -F you would still be out of luck. The Almquist shell has no built-in command for listing the names of available shell functions.

This is in fact the same question as "ash: List functions" and "dash: List declared functions". The Debian Almquist shell, the FreeBSD Almquist shell, and the BusyBox Almquist shell are all the Almquist shell. Whilst there are differences amongst them (in particular the setvar builtin, the let builtin, and suchlike) they do not extend to a difference in this respect.

In fact, no flavour of the Almquist shell has this. So you probably do not need to ask this a fourth time about another Almquist shell. ☺

Further reading

JdeBP
  • 68,745