I have read literally every answer on the net that I could find. Nothing is similar to my problem, so here it is:
I have a bash script with curl and I get a variable back. I want to update my database with this variable, however it doesn't work.
My variable is $stream and no matter what I do, I always get the word "$stream" into the database instead of the result of the curl.
My script is:
#!/bin/bash
stream=$(curl --silent "https://player.mediaklikk.hu/playernew/player.php?video=mtv1live&noflash=yes&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=&osfamily=Windows&osversion=10&browsername=Chrome&browserversion=97.0.4692.99&title=M1&contentid=mtv1live&embedded=0" | grep -Po 'file": "\K(.*?)(?=")' | sed 's/\\\/\\\//https:\\\/\\\//g')
echo $stream
mysql
use mydatabase;
UPDATE my_table SET my_url = "$stream" WHERE my_name = 'stream_name';
mysqlin the first place. You need to use<<to make it a here-document.mysqlit's going to wait for you to type commands, it won't treat the following lines as SQL commands.