如何在 Windows 10 中的 Apache NiFi 中执行 Linux bash 命令
How to execute Linux bash command in Apache NiFi in Windows 10
我在安装了 Linux 子系统 (Ubuntu) 的 Windows 10 机器上使用 NiFi。
我的任务是使用 NiFi 执行 bash 脚本和命令。我尝试将 ExecuteProcess
和 ExecuteStreamCommand
与选定的命令一起使用,例如简单的 'bash
' 或 'bash ls
' 用于测试目的,但我得到的只是:
ExecuteProcess[id=4f530725-0171-1000-d1b1-7df587eada7e] /bin/ls:
/bin/ls: cannot execute binary file
如果我尝试传递基本的 Windows 命令,一切正常。
在我的情况下,有没有办法 运行 bash 命令?
我不是 Windows 用户,但根据 docs,为了获得 Linux 风格的命令,您必须 运行 Bash.exe
,所以我猜你需要指定 -c
作为参数,然后是你想要 运行 (作为字符串)的 Linux bash 命令,类似:
bash -c "ls"
我在安装了 Linux 子系统 (Ubuntu) 的 Windows 10 机器上使用 NiFi。
我的任务是使用 NiFi 执行 bash 脚本和命令。我尝试将 ExecuteProcess
和 ExecuteStreamCommand
与选定的命令一起使用,例如简单的 'bash
' 或 'bash ls
' 用于测试目的,但我得到的只是:
ExecuteProcess[id=4f530725-0171-1000-d1b1-7df587eada7e] /bin/ls: /bin/ls: cannot execute binary file
如果我尝试传递基本的 Windows 命令,一切正常。
在我的情况下,有没有办法 运行 bash 命令?
我不是 Windows 用户,但根据 docs,为了获得 Linux 风格的命令,您必须 运行 Bash.exe
,所以我猜你需要指定 -c
作为参数,然后是你想要 运行 (作为字符串)的 Linux bash 命令,类似:
bash -c "ls"