'Contact multiple variable with string bash

This is my script code

#!/bin/bash
timestamp=$(date +%F-%T)
clinet_id="123"

STRING=s3://<bucketname>/folder/$client_id/$client_id_gdpr_access_report_$timestamp.csv
echo "$STRING"
$SHELL

If i run this code am getting timestamp value.csv file how can i concatenate variable with string. am expecting out put like below

s3://<bucketname>/folder/123/123_report_2022-01-25-14:55:47.csv

i can able to concatenateaccess_report_$timestamp.csv if i add $client_id_ in the beginning, it will print

 2022-01-25-14:55:47.csv

Expecting a better advice



Solution 1:[1]

You need to look better at the names of your variables; it's 'client_id' not 'clinet_id' ...

And you should take care of double quoting your string, and put braces around variables when in doubt:

STRING="s3://<bucketname>/folder/${client_id}/${client_id}_gdpr_access_report_${timestamp}.csv"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 phranz