[Mono-list] Running a shell builtin from mono

Mathias Tausig mathias.tausig at a-cert.at
Thu Feb 7 15:10:44 UTC 2013


On Thursday 07. February 2013 12:05:32 Ian Norton wrote:
> On Thu, Feb 07, 2013 at 11:08:22AM +0000, Mathias Tausig wrote:
> > Hy!
> > 
> > I want to execute a shell builtin command from mono on a linux box. (To be
> > precise: I want to read the current umask with the 'umask' command). Using
> > the Process class doesn't work, since it looks for an actual command file
> > to run. Is there a way to do this?
> 
> how about running "bash -c umask" and capturing the output?
> 
> Ian

You're right, that would work for umask (as would Ulrich's suggestions with 
Mono.Unix.Native.Syscall.umask). But it won't work for other builtins (like 
jobs or set), because it starts a new shell. I'm curious, if there is a 
generic solution for this problem.

cheers
Mathias


More information about the Mono-list mailing list