Reputation: 599
I'm new to bash scripting so would need your help. I am trying to get data from mysql database and use the parameters for a http call. For example,
$string = data from mysql
http://www.company.com/organizer/$string
How do I retrieve data from mysql and store in a string then use it for the http call? I need to execute the http url like using it in the browser.
My current codes are as:
#!bin/bash
$string = mysql Company<<EOFMYSQL
select name from HR;
EOFMYSQL
Upvotes: 0
Views: 348
Reputation: 5064
how about the following?
string="`mysql -uusername -ppassword dbname -e 'select * from foo;'`"
url="http://www.company.com/organizer"
url="$url/$string";
wget "$url"
Upvotes: 1
Reputation: 140417
You want to use command substitution via $()
#!/bin/bash
string=$(mysql ...)
echo "http://www.company.com/organizer/$string"
Upvotes: 1