-1

I have a .sh script that do this:

bcp "EXEC SPName"  queryout "test.csv" -k -w -t"," -S "$server" -U "$user" -P "$pass"

The variables $server, $user and $pass are being read from a external config file.

The problem is that the variables don't work and give me always connection timeout. For example if I use the same command but with the variables hard coded works fine:

bcp "EXEC SPName"  queryout "test.csv" -k -w -t"," -S "TEST" -U "admin" -P "admin"

How I can make the command dynamic?

tg_dev3
  • 171
  • 3
  • 18

1 Answers1

2

I found the problem, I was reading the variables from a external json file created in Windows and the file contained "\r" at the end and then the command could not execute.

How I solved:

sed -i 's/\r//g' YourFile.json
tg_dev3
  • 171
  • 3
  • 18