I have a script that has some functions.
Can I run one of the function directly from command line?
Something like this?
myScript.sh func()
>
Solved post but I'd like to mention my preferred solution. Namely, define a generic one-liner script eval_func.sh:
#!/bin/bash
source $1 && shift && "@a"
Then call any function within any script via:
./eval_func.sh ...
An issue I ran into with the accepted solution is that when sourcing my function-containing script within another script, the arguments of the latter would be evaluated by the former, causing an error.