Listing the Unix functions available

From time to time, I wrack my brain to recall a shell function name. The shell script below produces a text list of all of them with a brief description on your desktop as Unix_Functions.txt.

This script was created by Cameron Hayne at forums.MacOSXhints.com. The same shell script with some further explanations can be found post #14 of Hayne’s UNIX FAQ

I can’t explain its details, so don’t ask. :rolleyes: (It takes a moment to do this, so don’t panic).

[EDIT] This has now appeared as a MacOSXhints.com Hint by Hayne with an explanation of how it works.


do shell script "echo $PATH | sed -e 's/:/ /g' | xargs -J % find % -maxdepth 1 \\( -type f -or -type l \\) | xargs basename | sort | uniq | xargs whatis 2> /dev/null | grep -E '\\((1|1m|6|8)\\)' | perl -ne '($name, $descrip) = m/^(.*?)\\s+- (.*)$/; $name =~ s/\\((1|1m|6|8)\\)//g; printf(\"%-20s - %s\\n\", $name, $descrip)' > ~/desktop/Unix_Functions.txt"

[EDIT] - Updated to keep it current with Hayne’s version. The update follows symbolic links too.