Linux的 - 我怎么能运行在命令行的脚本功能? [英] linux - How can I run a function from a script in command line?
本文介绍了Linux的 - 我怎么能运行在命令行的脚本功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有脚本,有一些功能。
I have script that has some functions.
我可以直接运行命令行功能之一?
Can I run one of the function directly from command line?
像
myScript.sh func()
推荐答案
如果脚本只定义的功能和什么也不做,你可以先在当前shell的上下文中使用执行脚本的源
或。
命令,然后简单地调用该函数。参见帮助源
了解更多信息。
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.
这篇关于Linux的 - 我怎么能运行在命令行的脚本功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文