-1
if [ $pass = "123456" ] ; then mysql -u root -p$pass "create database newdb"; use newdb; CREAT TABLE user ( name char (30) , lname char (40) );
echo "creat table succesful" fi 

When I run it it outputs start and then says Syntax error:

"(" unexpected (expecting "fi")

How could I fix this?

Fruchtzwerg
  • 10,999
  • 12
  • 40
  • 49
m.taba
  • 1
  • 2

1 Answers1

0

Change it to

if [ $pass = "123456" ] ; then mysql -u root -p$pass "create database newdb"; use newdb; CREAT TABLE user ( name char (30) , lname char (40) ); echo "creat table succesful"; fi

that is a semicolon before the fi.

Also the entire command sequence to mysql probably has to be in double quotes.

Uwe Innh
  • 106
  • 4