I've been using a program of mine written in bash to interact with a mysql database, I switched to microsoft sql server and now I have a very strange issue. The code below worked with mysql. With microsoft sql server I can see that it successfully pulls the count. My "echo $id" shows a value of 23 like it should but the issue is bash spits out " Syntax error: Bad for loop variable". I'm confused at why it's doing that 23 is an integer value. Please Help.
id="`tsql -S Server\\SqlServerName -U Databas_Name -P Password -o q <<EOF
use numbers
go
SELECT COUNT(*) FROM lotsa_numbers
go
quit
EOF`"
echo $id
for (( c=0; c=>$id-1; c++ ))
do
echo $c
done
c<=$id?id=$(echo $id)before the for loop (this will truncate leading and trailing whitespace, etc...)