Concatenate string literals

I've seen a couple posts for this, like this one, but none are helping me in my particular situation.

scriptsPath="/var/db/gbi/scripts/"
echo "$scriptsPathawesome.csv";

I would expect this to echo /var/db/gbi/scripts/awesome.csv

Instead I get .csv

Seems like it thinks I'm trying to reference a variable named $scriptsPathawesome . How can I concatenate the $scriptsPath variable to the "awesome.csv" string literal?


你需要用大括号括住你的变量,如下所示:

scriptsPath="/var/db/gbi/scripts/"
echo "${scriptsPath}awesome.csv";
链接地址: http://www.djcxy.com/p/29142.html

上一篇: 循环内的Bash变量串联失败

下一篇: 连接字符串文字