Fedora bash程序无法正常运行 [英] Fedora bash program not working properly
本文介绍了Fedora bash程序无法正常运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图只运行一个简单的bash命令,但是我不确定我错过了什么
I am trying to just run a simple bash command but i'm not sure what i'm misssing
#!/bin/bash
$person = Craig Baiey
echo $person
echo '$person'
echo "$person"
每次我运行它都会收到错误消息 第2行:=:找不到命令
everytime I run it i get an error line 2: =: command not found
$ person
推荐答案
空格是=
周围的问题.应该是:
Space is the problem around =
. It should be:
person="Craig Baiey"
- 您没有将变量分配给名称为
$
的变量. - 那里也需要引号.
- You don't assign into variable with
$
in name. - And quotes are also required there.
此行将不会显示变量的值:
btw this line won't print the variable's value:
echo '$person'
由于shell由于单引号的存在而无法扩展.它将改为文字$person
As shell won't expand it due to presence of single quotes. It will instead literal $person
这篇关于Fedora bash程序无法正常运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文