We are going to write a simple function in our shell script to return the current date and time. Create a script function_example.sh, and write this code in it:
#!/bin/bashprint_date(){echo "Today is `date`"return}print_date
Now we will create another script containing two functions with the same name. Create a script function2.sh, and write the following content in it.
#!/bin/bashdisplay ( ) {echo 'First Block'echo 'Number 1'}display ( ) {echo 'Second Block'echo 'Number 2'}displayexit 0