bash: C:/Program: 没有那个文件或目录 [英] bash: C:/Program: No such file or directory

查看:65
本文介绍了bash: C:/Program: 没有那个文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Docker、Debezium、Bash 和 Kafka 的新手.我正在尝试在此处为 Windows 10 上的 MSSQL Server 运行 Debezium 教程/示例:

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'

我收到以下错误:

bash: C:/Program: 没有那个文件或目录

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

我不知道为什么它甚至会将 C:/Program 拖入其中.我没有在命令中看到它,也没有在 *.sql 文件中看到它.有谁知道为什么会发生这种情况以及解决方法是什么?

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?

注意 1:我已经在当前目录中该命令应该可以运行并且文件夹/文件路径中没有空格

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

注意 2:我在 Git Bash 中运行命令

Note 2: I am running the commands in Git Bash

当使用 set -x 来记录命令的运行方式时,其中仍然没有 C:/Program ,如以下日志所示:

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

推荐答案

昨天我也遇到了类似的问题,解决方法是在绝对路径前加一个反斜杠,比如:

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 阻止转换为 Windows 路径.

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

这篇关于bash: C:/Program: 没有那个文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆