Basic function syntax (pre-parameters)

funct_name()
{
    body_of_function
}

...

funct_name

*   you DO have to define the function before you
    can use it
*   you DON'T put () after the function name when you
    call it -- you get an ERROR if you do!

how can you run a function from 1 shell script in
another?
*   if you source a shell script A within a shell
    script B, then any variables or functions
    or things created by the sourced shell script
    A can be USED in shell script B

parameters!
*   you DON'T put anything in the header for
    parameters!
... you just refer to $1, $2, $3, ... $@ etc.
    IN THE FUNCTION BODY

    (PLEASE NOTE -- the $1, $2, etc. in a
    function body are thus NOT the same as
    the $1, $2, etc. not in function bodies
    in the rest of the shell script)

*   note: you CANNOT change the parameters --
    (how WOULD you change $1? Can't say 1=...)

    you CAN change a non-parameter variable,
    and the result will be seen outside the
    function;
    and you can set a variable for the first
    time in a function body, and it can be
    seen after a call to that function in the
    script/caller

*   (if you want to use the "outer" script's
    arguments in a function,
    you could pass them AS a function argument,
    or you could set a named variable to the
    shell script argument and the function body
    could see and use the named variable

*   also note:
    a function WILL be called in a sub-shell
    if its output is piped somewhere else --
    so,   myfunct 1 2 3 | tee out.txt
    ...is run in a sub-shell, not the current
    shell
    ...and THAT call cannot change x in the
    current shell