On 10-May-2019 14:52, David Mathog wrote:
Is there a way that a program can do:

   status = system("some command");

Found it right after posting, change "COMSPEC". Which works, but only sort of.
I have a program "execinput" which takes input and for each line does

   system();

Changed COMSPEC in a mintty window in bash shell to point to bash, then did

  set COMSPEC='C:\progs\msys32\usr\bin\bash.exe'
  echo 'pwd' | execinput
(prints the current directory) #<-- in cmd.exe pwd throws an error, so it is in bash
  echo 'ls -al' | execinput
  (lists as expected)
  echo 'echo one' | execinput
  one
  #it goes wrong at the next command
  echo 'echo one ; echo two ; echo three' | execinput
  one ; echo two ; echo three
  echo 'echo one & echo two & echo three' | execinput
  one
  two
  three

So it seems to work for ONE command, but for a compound command
for whatever reason it expects cmd.exe style command separators and not bash ones.

Is some other environmental variable required to make compound commands work?

Thanks,

David Mathog
[email protected]
Manager, Sequence Analysis Facility, Biology Division, Caltech


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to