[Mono-list] Running a shell builtin from mono
mathias.tausig at a-cert.at
Fri Feb 8 10:39:48 UTC 2013
On Friday 08. February 2013 10:45:32 Ulrich Hertlein wrote:
> Hi Mathias,
> On Fri, Feb 8, 2013 at 2:10 AM, Mathias Tausig <mathias.tausig at a-
> > 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.
> Since any exec always starts a fresh shell there won't be any jobs to
> control or variables to set/get (other than what is set initially) to begin
Does it? I didn't know that. I assumed it uses the same shell that mono is
> What are you trying to achieve?
I started with the problem of reading the current umask. After I realised,
that I can get that information by other means, I just remained curious.
Thanks for the help.
More information about the Mono-list