Here is my script
#!/bin/bash
clear
PSQLSTART="INSERT INTO TABLE (Name, Description, Field3, Field4, Field5, Field6, Field7, Field8, Field9, Field10, Field11, Field12, Field13, Field14, Field15, Field16, Field17, Field18) VALUES"
echo "What is the name of my CSV File?"
read CSVFILE
echo "What is the server IP?"
read INTIP
echo "What is the server username?"
read INTUSER
echo "What is the server password?"
read INTPW
while IFS=\| read -r col1 col2 col3 col4 col5; do
sshpass -p "$INTPW" ssh -no StrictHostKeyChecking=no $INTUSER@$INTIP "echo $PSQLSTART$col1$col2$col3$col4$col5 >> /home/user/test.txt"
done < "$CSVFILE"
Here is what my CSV file looks like
("testname|","|test description|", 1, 1, 1, 0, 0, "|test_url|", "", 0, 0, "", 0, 0, 0, 0, 0, 0);
Here is my output and Error.
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF8)
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `echo INSERT INTO TABLE (Name, Description, Field3, Field4, Field5, Field6, Field7, Field8, Field9, Field10, Field11, Field12, Field13, Field14, Field15, Field16, Field17, Field18) VALUES("testname","test description", 1, 1, 1, 0, 0, "test_url|", "", 0, 0, "", 0, 0, 0, 0, 0, 0); >> /home/user/test.txt'
I looked up the errors but I could not find anything that's wrong with my script. Please help. Also I am new to bash scripting so this may be an easy fix, I just can't tell.