Please tell me how to export a function in parent shell (bash, sh or ksh) so that the function will be available to all the child process launced from the parent process?
The export -f
feature is specific to Bash:
parent
#!/bin/bash
plus1 () { echo $(($1 + 1)); }
echo $(plus1 8)
export -f plus1
./child 14 21
child
#!/bin/bash
echo $(plus1 $(($1 * $2)) )