Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

excute bash and other linux scripts from c#

using System;
using System.Diagnostics;

namespace runGnomeTerminal
{
    class MainClass
    {
        public static void ExecuteCommand(string command)
        {
            Process proc = new System.Diagnostics.Process ();
            proc.StartInfo.FileName = "/bin/bash";
            proc.StartInfo.Arguments = "-c " " + command + " "";
            proc.StartInfo.UseShellExecute = false; 
            proc.StartInfo.RedirectStandardOutput = true;
            proc.Start ();

            while (!proc.StandardOutput.EndOfStream) {
                Console.WriteLine (proc.StandardOutput.ReadLine ());
            }
        }

        public static void Main (string[] args)
        {
            ExecuteCommand("gnome-terminal -x bash -ic 'cd $HOME; ls; bash'");
        }


    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: cs entity framework 
Csharp :: getname of month from date c# 
Csharp :: wpf restart application c# 
Csharp :: unity how to stop the game 
Csharp :: c# get class name by type 
Csharp :: get connectionstring from web config c# 
Csharp :: c# error CS0515 
Csharp :: read xml file c# 
Csharp :: c# restart app 
Csharp :: c# string array initialization 
Csharp :: list with two values c# 
Csharp :: unity how to load a scene 
Csharp :: print random number unity 
Csharp :: unity deltatime 
Csharp :: get hard disk serial number 
Csharp :: unity ignore collision between two objects 
Csharp :: how to deselect a button through code unity 
Csharp :: hashset to list c# 
Csharp :: c# string remove special characters 
Csharp :: untiy instanciate prefab 
Csharp :: return json from controller c# 
Csharp :: c# array 
Csharp :: c# current dir 
Csharp :: c# print exception stack trace 
Csharp :: c# list with 0 initialize 
Csharp :: defaultrequestheaders.authorization basic auth 
Csharp :: if number negative c sharp 
Csharp :: list.max c# 
Csharp :: press key run code unity c# 
Csharp :: unity actions 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =