List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:March 25 2002 3:36pm
Subject:Re: Parameter passing on shell script
View as plain text  
Try:

echo "
load data infile '/home/loader/txt/file_${date_proc}.txt' into table debits
fields terminated by ';'
" | mysql -u user -ppass dbname 



Oswaldo Castro wrote:

>Hi List
>
>I'm new to MySQL and I need help on how to pass shell parameter to a mysql
>script file (bash/SuSE 7.2)
>
>I have one file called run_db_load and I called it from the command line as
>
># date_proc=25032002
>
># export date_proc
>
># ./run_db_load $date_proc
>
>
>
>Inside the run_db_load file I have:
>
>mysql -u user -ppass dbname < file_to_load.sql
>
>
>
>Inside the file_to_load.sql I need to capture the $date_proc variable, so
>its content is:
>
>load data infile '/home/loader/txt/file_${date_proc}.txt into table debits
>fields terminated by ';'
>
>
>
>The problem is that the ${date_proc} doesn't get substituted and MySQL give
>an error.
>
>Any help will be very appreciated
>
>Thanks in advance
>
>Oswaldo Castro
>
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread104063@stripped>
>To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


Thread
Parameter passing on shell scriptOswaldo Castro25 Mar
  • RE: Parameter passing on shell scriptGurhan Ozen25 Mar
  • Re: Parameter passing on shell scriptGerald Clark25 Mar