Frage

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?

War es hilfreich?

Lösung

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

scriptsPath="/var/db/gbi/scripts/"
echo "${scriptsPath}awesome.csv";
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top