Please let em know if this is valid.......

I am trying to run mysql from my shell script by passign a parameter.the sql(script.sql) is in directory $mydir and the parameter is $date and trying to run it this way:

un="username"
pd="PASSWORD "
dbname="dbname"


result = `mysql($un,$pd,$dbname,$mydir,"script.sql",$date)`

I am trying to store the date in result.is this valid statement???

Please advise???????
thanks so much!!!!!

Hey There,

Your getting the result from the backticks is valid. I can't be sure about the mysql() function that you're referencing though. Can you post that?

Thanks,

, Mike

Hi ,

purpose of my script is that it should generate a report by running a sql script which is stored in a directory and pull the information from DB.script shld be in such a way that I just need to pass a parameter and it shld generate the report and store it in a directory in a particular format like date and time.

for example
report _ details _date__13-3-4.txt .here date is the parameter I pass.

here is the script I wrote.please let me know if valid

#!/usr/bin/ksh
un="username" # USERNAME
pd="password" # PASSWORD
dbname="dbname"

set linesize 550;
set pagesize 40;
break on report ;
set echo off

###### input box for passign the variable#####
dialog --title "Inputbox " --inputbox "Enter the date " 8 60 2>/tmp/input.txt

date=`cat /tmp/input.txt

Report(date)
Function Report(date)

#### directory where my sql script lies####
SqlDir = "C:\tmp\scripts\"
OutputDir = "C:\tmp\scripts\report\"

### directory where I want the report####
pwd=$OutputDir + '/' + $date + '/'

####running the sql script from mysql by passing the date ##
mysql($un,$pd,$dbname,$SqlDir,"script.sql",$date) >> /tmp/result.txt

####report format###
ReportFile = "report_details" + "_" + $date + "-" + `date +%d_%m_%Y` + ".txt"

mv result.txt ReportFile
Report = $OutputDir + $date + "\" + $ReportFile

End Function


Please correct me if I went wrong anywhere.
Appreciate any suggestions!!

Hey There,

Could you post the function you're calling on this line:

mysql($un,$pd,$dbname,$SqlDir,"script.sql",$date) >> /tmp/result.txt

I'm not sure what you're actually doing to connect so I can't say if you're doing it correctly or not.

You should have a mysql() function in your script or in your environment.

Thanks :)

, Mike

Hey I am totally new to this shell thing. I just want to upload huge datas like about 2GB into online server using phpmyadmin but it seems impossible so googled little bit and found about shell script to upload huge amount of datas. But I don't know where to write or what to do. Plz if there's anyone to help me from very beginning. Highly appreciate your support. Thankyou.

This article has been dead for over six months. Start a new discussion instead.