LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-24-2005, 08:53 PM   #1
hondaman
Member
 
Registered: Feb 2004
Location: Dallas
Distribution: Fedora
Posts: 59

Rep: Reputation: 15
Bash scripting, mysql, and creating tables.


I am trying to write a script that creates a table, and I am not getting very far with it. This is what I have:

#!/bin/bash

DBHOST=localhost
DBUSERNAME=root
DBUSERPASS=password
DBNAME=pt1
DBTABLE=1100

DBCON="/usr/bin/mysql -h$DBHOST -u$DBUSERNAME -p$DBUSERPASS"
TABLEADD="CREATE TABLE $DBTABLE x VARCHAR(25), y VARCHAR(25), z VARCHAR(25), planet name VARCHAR(25), ruler name VARCHAR$
$DBCON && $TABLEADD

So when I execute it, it just goes into mysql and doesnt pass along the table creation part. What am I doing wrong?
 
Old 09-24-2005, 10:48 PM   #2
TruckStuff
Member
 
Registered: Apr 2002
Posts: 498

Rep: Reputation: 30
Change the last line to
Code:
$DBCON < $TABLEADD
 
Old 09-25-2005, 06:17 AM   #3
hondaman
Member
 
Registered: Feb 2004
Location: Dallas
Distribution: Fedora
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by TruckStuff
Change the last line to
Code:
$DBCON < $TABLEADD
bash: $TABLEADD: ambiguous redirect
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql reinstallation distorted by previous tables in /var/mysql mad4linux Linux - Software 0 10-04-2005 02:39 PM
MySQL tables from 4.0 to 3.0 michaelbhahn Linux - Software 0 08-31-2004 11:23 AM
Corrupted MySQL Tables cli_man Linux - Software 4 10-22-2003 07:49 AM
mysql tables with a - pk21 Linux - Software 7 05-23-2003 07:27 AM
mysql tables noord28 Linux - Newbie 0 02-20-2003 03:56 AM


All times are GMT -5. The time now is 11:52 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration