[Mono-list] Running a shell builtin from mono

Ulrich Hertlein u.hertlein at gmail.com
Thu Feb 7 23:45:32 UTC 2013


Hi Mathias,

On Fri, Feb 8, 2013 at 2:10 AM, Mathias Tausig <mathias.tausig at a-cert.at>wrote:

> 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
with.

What are you trying to achieve?

/ulrich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20130208/4956dc7d/attachment.html>


More information about the Mono-list mailing list