Bash功能->没有找到指令 [英] Bash Function -> Command not found
本文介绍了Bash功能->没有找到指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好急,我正在尝试学习Bash,但似乎无法使该基本脚本正常工作.
Hi gusy I am trying to learn Bash and cannot seem to get this basic script to work.
#!/bin/bash
function system_info
{
echo "function system_info"
}
$(system_info)
我得到一个功能:找不到命令.
I get a function: command not found issue.
非常感谢任何帮助
推荐答案
Bash试图评估system_info
函数输出的字符串.您将尝试以下操作,只需运行以下功能即可:
Bash is trying to evaluate the string that is outputted by the system_info
function. You'll want to try the following, which will just simply run the function:
system_info
或将输出值存储到变量:
or to store the outputted value to a variable:
value=$(system_info)
这篇关于Bash功能->没有找到指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文