【发布时间】:2019-07-25 20:46:04
【问题描述】:
操作系统:Linux 4.15.0-48-generic #51-Ubuntu
框架:.NET Core 4.6.27817.03
我在下面有以下sample.sh 文件:
#!/bin/bash
netstat --tcp --listen --numeric-ports -p
以及执行此文件的以下函数:
string filePathExecute = "./Assets/SystemTests/sample.sh";
FileInfo fileInfo = new FileInfo(filePathExecute);
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = true;
startInfo.FileName = "/bin/bash";
startInfo.Arguments = $"\"{fileInfo.FullName}\"";
Process process = Process.Start(startInfo);
但我得到以下输出:
xdg-open: unexpected argument '/home/{filePathHere}/Assets/SystemTests/sample.sh'
Try 'xdg-open --help' for more information.
如何让我的应用程序打开一个新的终端窗口并在其中运行sample.sh?
【问题讨论】:
-
.NET Core 的实际版本是什么? 3.0还没有发布,所以4.6是不可能的。
-
NET Core 2.2.6(CoreCLR 4.6.27817.03,CoreFX 4.6.27818.02)