I am running Ubuntu Shell command through C# code, when I run this Script in Ubuntu it shows as 'Syntax OK' but when I run it through C# code it Always returns exitCode - 1. Please Correct my code if something id wrong.
string _exitCode="";
Process proc = new Process();
proc.StartInfo.FileName = "/bin/bash";
proc.StartInfo.Arguments ="-c \" apachectl -t -f /etc/apache2/sites-enabled/example.conf \"";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.Start();
proc.BeginOutputReadLine();
proc.StandardError.ReadToEndAsync();
proc.WaitForExit(3000);
if (!proc.HasExited)
proc.Kill();
_exitCode = proc.ExitCode.ToString();