To join/concatenate two variables in bash-script use following:

1) “${var1}_${var2}” # here we have joined var1 and var2 separated by ‘_’

2) basePath=”/home/anj/” # base part.
fileName=”myfile.txt” # fitename
fileName=”${basePath}/${fileName}” # separated by /

It is quite simple just place each variable adjacent to each other.
${basePath}/${fileName}” avoid variable substitution issues (if any).

Leave a Reply

Your email address will not be published. Required fields are marked *