ubuntu - ProcessStartInfo not recognising command inside .sh file -
i'm trying run next commands file called teste.sh
kpm restore k web
they run fine when open terminal cd right folder , "sh teste.sh", when seek run next on monodevelop:
using system; using system.diagnostics; namespace terminalcommandteste { class mainclass { public static void main (string[] args) { startwebserver (); } public static void startwebserver () { string command = "sh"; //string argss = "/home/daniel/downloads/helloworldvnext-master/src/hellomvc/teste.sh"; string dir = "/home/daniel/downloads/helloworldvnext-master/src/hellomvc/"; string argss = "teste.sh"; processstartinfo procinfo = new processstartinfo (); procinfo.windowstyle = processwindowstyle.normal; procinfo.useshellexecute = false; procinfo.filename = command; procinfo.arguments = argss; procinfo.workingdirectory = dir; process.start (procinfo); } } }
the response on terminal is:
teste.sh: 1: teste.sh: kpm: not found teste.sh: 2: teste.sh: k: not found press key continue...
managed prepare issue alexkoeplinger, alxandr.me , yantr.io in https://jabbr.net/#/rooms/aspnetvnext chat
changed project to
using system; using system.diagnostics; namespace terminalcommandteste { class mainclass { public static void main (string[] args) { startwebserver (); } public static void startwebserver () { string command = "/bin/bash"; //string argss = "/home/daniel/downloads/helloworldvnext-master/src/hellomvc/teste.sh"; string dir = "/home/daniel/downloads/helloworldvnext-master/src/hellomvc/"; string argss = "teste.sh"; processstartinfo procinfo = new processstartinfo (); procinfo.windowstyle = processwindowstyle.normal; procinfo.useshellexecute = false; procinfo.filename = command; procinfo.arguments = argss; procinfo.workingdirectory = dir; process.start (procinfo).waitforexit(); } } }
and teste.sh to
#!/bin/bash source "/home/daniel/.kre/kvm/kvm.sh" kpm restore k web
ubuntu process monodevelop asp.net-core processstartinfo
No comments:
Post a Comment