xiaoyunwu
asked on
linux shell substitute variable
I have list of tables in t.txt file, I need to substitute all the ${table} instance with the table name in t.txt file. the challenge here is after the single quote, the ${table} variable will not be substituted, like the following code, only the first ${table} will be substituted, the last two does not. How can I do this? Thanks.
for table in `cat t.txt`
do
curl -XPUT "http://localhost:9200/_river/${table}_river/_meta" -d '{
"type" : "jdbc",
"jdbc" : {
"driver" : "oracle.jdbc.driver.OracleDriver",
"url" : "jdbc:oracle:oci:@test",
"user" : "test",
"password" : "test",
"sql" : "select * from ${table} where rownum<3"
},
"index" : {
"index" : "database",
"type" : "${table}"
}
}'
done
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER