This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am using Bash shell. I want to call function in one shell script into the other.
I know I can reference one shell script into the other using '.' operator or using 'source'
My shell script applib.sh(containing function) is using "getopts" and throws usage followed by exit 1 when called without arguments.
So when I include this script(applib.sh) within another script say, "uselib.sh", using '.' or 'source' and try to run "uselib.sh"
it executes "applib.sh", and exits.
So I wanted to know is there any other way where in I can call function from "applib.sh".
OR let me know if I need to follow some standard
like I need to keep all functions in separate file and make use of them including this file in my scripts ?
Good, Better, Best, Don't take rest until, Good becomes Better, and Better becomes Best.
Sidd : (SCJP 6 [90%] )
If you're running one of the Red Hat flavors such as Fedora, just look in the /etc/init.d directory. A lot of their scripts do what you want. It allows them to have common code for displaying start/stop messages, daemonizing, and various networking functions.
You may find similar functionality in the non-RedHat distros such as Debian and Ubuntu, but I haven't spent that much time in their initscripts to be able to say for sure.
An IDE is no substitute for an Intelligent Developer.