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?

有帮助吗?

解决方案

You need to surround your variable with curly braces like so:

scriptsPath="/var/db/gbi/scripts/"
echo "${scriptsPath}awesome.csv";
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top