LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Functions in bash script (https://www.linuxquestions.org/questions/programming-9/functions-in-bash-script-610285/)

som_kurian 12-31-2007 11:15 PM

Functions in bash script
 
Is it possible to define functions and called in bash script as in C++

weibullguy 01-01-2008 12:32 AM

If you're willing to research a little, Bash functions --> http://tldp.org/LDP/abs/html/abs-guide.html#FUNCTIONS

pixellany 01-01-2008 08:11 AM

I strongly recommend downloading the pdf version of ABS and using it for searches. (Don't print it unless you are into killing trees.)

gnashley 01-01-2008 09:12 AM

Functions are easy to use in bash. Just be sure that they come first in your script before they are called:

Code:

#!/bin/bash

hello_world() {
echo "Hello world!"
}

hello_world
exit 0



All times are GMT -5. The time now is 02:09 AM.