本文介绍了单声道的Process.Start如何找到的bash?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的webapp我做的下面。我知道它的正确的,因为我倾倒start_sz到一个文本文件试过1)2)苏www数据3)复制/粘贴提取字符串,它的工作。

In my webapp i do the below. I know its correct because i tried 1) dumping start_sz to a text file 2) su www-data 3) copy/paste the extract string and it worked.

var start_sz = string.Format(@"bash -c 'ln ""{2}/{0}"" ""{2}/{1}""'", fn, newfn, System.IO.Directory.GetCurrentDirectory());
Process.Start(start_sz);



我得到的异常的下方,与推理之上,我相信它说的bash无法找到。

I get the exception below so with reasoning above i believe its saying bash cannot be found.

找不到指定文件

在System.Diagnostics.Process.Start_shell(系统。 Diagnostics.ProcessStartInfo StartInfo的,过程的System.Diagnostics.Process)[0x00000]在0

at System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0

在System.Diagnostics.Process.Start_common(System.Diagnostics.ProcessStartInfo StartInfo的,系统.Diagnostics.Process程序)[0x00000]在0

at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0

在System.Diagnostics.Process.Start(System.Diagnostics.ProcessStartInfo的StartInfo)[0x00000]中:0

at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x00000] in :0

在System.Diagnostics.Process.Start(System.String文件名)[0x00000]在0

at System.Diagnostics.Process.Start (System.String fileName) [0x00000] in :0

在MySite.QueueManager.MakeLink(System.String FN)[0x00000]在0

at MySite.QueueManager.MakeLink (System.String fn) [0x00000] in :0

在MySite.QueueManager.ImageQueue2()[0x00000]在0

at MySite.QueueManager.ImageQueue2 () [0x00000] in :0

在MySite.QueueManager.ImageQueue()[0x00000]在0

at MySite.QueueManager.ImageQueue () [0x00000] in :0

所以,我该如何解决这一问题?基本上,我需要建立一个硬连接(软是确定太)在我的asp.net应用程序运行时间。

So, how do i fix this? basically i need to create a hardlink (soft is ok too) at run time in my asp.net app.

我想也许我需要完整的bash路径所以我尝试然而/斌/ bash的-c 这也不能工作。

I thought maybe i need the full bash path so i tried /bin/bash -c however that didn't work either.

推荐答案

为什么不叫 LN 直接?如果没有庆典

Why not call ln directly? Without bash?

Process.Start("ln", params);



此外,你可能需要指定的完整路径:

Also you may need to specify the full path:

Process.Start("/bin/ln", params);






其实,的Process.Start(庆典)对我的作品,从而检查 $ PATH 环境变量等。


In fact, Process.Start("bash") works for me, thus check $PATH environment variable, etc.

这篇关于单声道的Process.Start如何找到的bash?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 15:35