Search code examples
bashcurlapache-kafkadebezium

bash: C:/Program: No such file or directory


I am new to Docker, Debezium, Bash, and Kafka. I am attempting to run the Debezium tutorial/example for MSSQL Server on Windows 10 here:

https://github.com/debezium/debezium-examples/blob/master/tutorial/README.md#using-sql-server

I am able to start the topology, per step one. However, when I go to step two and execute the following command:

cat debezium-sqlserver-init/inventory.sql | docker exec -i tutorial_sqlserver_1 bash -c '/opt/mssql-tools/bin/sqlcmd -U sa -P $SA_PASSWORD'

I get the following error:

bash: C:/Program: No such file or directory

I do not have the foggiest idea why it would even drag C:/Program in to this. I do not see it in the command nor do I see it in the *.sql file. Does anyone know why this is happening and what the fix is?

Note 1: I am already in the current directory where this command should be runnable and there are no spaces in the folder/file path

Note 2: I am running the commands in Git Bash


When using set -x to log how the command is run, there's still no C:/Program anywhere in it, as can be seen by the following log:

$ cat debezium-sqlserver-init/inventory.sql | docker exec -i tutorial_sqlserver_1 bash -c '/opt/mssql-tools/bin/sqlcmd -U sa -P $SA_PASSWORD'
+ cat debezium-sqlserver-init/inventory.sql
+ docker exec -i tutorial_sqlserver_1 bash -c '/opt/mssql-tools/bin/sqlcmd -U sa -P $SA_PASSWORD'
bash: C:/Program: No such file or directory

Solution

  • I had a similar problem yesterday, the solution was adding a backslash before the absolute path, like :

    cat debezium-sqlserver-init/inventory.sql | docker exec -i tutorial_sqlserver_1 bash -c '\/opt/mssql-tools/bin/sqlcmd -U sa -P $SA_PASSWORD'
    

    \/opt/mssql-tools/bin/sqlcmd prevents conversion to Windows path.