Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Linux Terminal Commands

Hi there
ive recently moved to linux and i need to start a bash window in separate window from my current program so what i did was
download mono and mcs and made my secondary program (the one i need to open) to exe this is the code behind:
Code
int port = Convert.ToInt32(args[0]);
            string path = args[1];

            Process.Start("/bin/bash", "-c \"cd " + path + " && ./ngrok tcp " + port + "\"");

And ive opened it using Process.Start and added some arguments to it but the exe was opened in the same window as mine
is there any way i can solve that?

Thanks for help
(Jul 22, 2019 02:36 AM)HardStoN Wrote:  Hi there
ive recently moved to linux and i need to start a bash window in separate window from my current program so what i did was
download mono and mcs and made my  secondary program (the one i need to open) to exe this is the code behind:
Code
int port = Convert.ToInt32(args[0]);
           string path = args[1];

           Process.Start("/bin/bash", "-c \"cd " + path + " && ./ngrok tcp " + port + "\"");

And ive opened it using Process.Start and added some arguments to it but the exe was opened in the same window as mine
is there any way i can solve that?

Thanks for help

Not quite sure since I haven't tested on linux, but using the Process.Start() overload that takes a ProcessStartInfo object as parameter, you can set UseShellExecute = true

Code
ProcessStartInfo startInfo = new ProcessStartInfo
{
   FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32", "cmd.exe"),
   Arguments = "/C echo 123",
   UseShellExecute = true
};

Process.Start(startInfo);
This should help you

https://askubuntu.com/questions/506985/c...s-commands
Monetizing the World

I never deal off-site

(except Autobuy)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by DumbChickenFeb 11, 2022 10:09 PM 3 93 Feb 11, 2022 10:09 PM
Last Post: MeW11
[C] by Aus10Feb 16, 2016 02:10 PM 7 156 Feb 16, 2016 02:10 PM
Last Post: Aus10
[Shell] by rootsh3llJul 1, 2015 02:26 PM 0 148 Jul 1, 2015 02:26 PM
Last Post: rootsh3ll