# this is more of a note to self to help remember the various ways one can write a function in bash

function fname () { stuff; }

function fname () ( stuff; )   # <----- preferred

# note if the function code (stuff) is surrounded with braces {} then commands like "exit" will exit the invoking shell.
# however, if the function code is surrounded with parenthesis () then commands like "exit" will only exit the function.
# in my practice its preferred to use the parenthesis version. However, the other version exists in case it is needed.

Leave a Reply

Your email address will not be published. Required fields are marked *