bashscr:functions
Bash - Functions
- How to use functions in bash
- Here an example: you can pass values returned by programms as parameter to check them.
#Functions====================================== function check() { FC=$1 if [ $FC != "0" ];then echo -e "--> ERROR\n" else echo -e "--> OK\n" fi } #============================================
- You can use the function by its name with parameter (here an exit code) e.g.:
check “$?”
bashscr/functions.txt · Last modified: 23.03.2013 17:22 by eanderalx