I have a script that has some functions.
Can I run one of the function directly from command line?
Something like this?
JavaScript
x
myScript.sh func()
Advertisement
Answer
If the script only defines the functions and does nothing else, you can first execute the script within the context of the current shell using the source
or .
command and then simply call the function. See help source
for more information.