[mythtv-users] MySQL script for mythfilldatabase
Tom Lichti
redpepperracing at gmail.com
Sat Feb 26 17:14:39 UTC 2011
On Sat, Feb 26, 2011 at 10:59 AM, Josu Lazkano <josu.lazkano at gmail.com> wrote:
> Hello all, I am trying to configure a bash script to execute
> mythtfilldatabase. I want to get the sourceid from mysql and use on
> the script. I have this piece of script:
>
> #!/bin/bash
> . ~/.mythtv/mysql.txt
> source=`echo "select sourceid from videosource where name='sat'" |
> mysql --database=${DBName} --user=${DBUserName}
> --password=${DBPassword}`
> echo $source
>
> I want to get on the "source" variable just the number of the
> sourceid, I get this output:
>
> $ sh mysql.sh
> sourceid 1
>
> How can I get it?
>
> Thanks for all your help and best regards.
#!/bin/bash
. ~/.mythtv/mysql.txt
source=`mysql --database=${DBName} --user=${DBUserName}
--password=${DBPassword} -sN -e "select sourceid from videosource
where name='sat'"`
echo $source
gives:
sh mysql.sh
6
Tom
More information about the mythtv-users
mailing list