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

左心房为你撑大大i 提交于 2020-05-17 06:33:04

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/61020187/bash-c-program-no-such-file-or-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!