Run a bash script and have a main() function like in C. Leave a Comment / bejiitaswrath / By John Cartwright / May 23, 2023 / 2 minutes of reading How to run a bash function when a script runs. This is just like the main() function in C.