I am using rhel 5. I am learning shell-scripting.I created a function named
vi /etc/bashrc (so that i can use this function even after logout)
currenttime()
{
echo -e "Current time is `date`";
echo -e "Calendar Of this month is `cal`";
echo -e "Good Bye Mr.$USER ..Have good day";
}
Now if i use this function as normal then there is no problem. But when I am using this function under a script file and try to execute that script. Now it is showing error currenttime
command not found
Vi my_script
currenttime
chmod +x my_script
sh my_script
currenttime command not found.
Now i am not able to understand if currenttime is working properly in normal manner like
#currenttime
-----working fine
But, if i use it in file it is showing error. Can you tell me the logic behind this.