defining functions in TWRP In "normal" android you start up a Terminal emulator or do "adb shell" and then from there you can defining a function by:

function name
{
 #code
}
name #runs "name"


But by using adb shell over TWRP it says the command "function" cannot be found. the command "whereis function" and "which function" provides no outputs and leaves me baffled. Any idea how to define function in TWRP, preferably over adb shell
When in recovery mount your /system using
adb shell mount /system

though twrp can be twitchy otherwise use in-twrp mount function to mount system and you should have full room to do what you need.
In recovery you have a functioning kernel, so after mounting your system you should have every thing at your disposal

adb shell mount /system
adb shell
~ # mount | grep system
/dev/block/platform/msm_sdcc.1/by-name/system on /system type ext4 (rw,seclabel,relatime,data=ordered)
~ # export PATH=/system/bin:/system/xbin:$PATH
~ # which busybox
/system/xbin/busybox
~ # which sh
/system/bin/sh