[Mono-list] csharp REPL
Ian Norton
Ian.Norton-Badrul at thales-esecurity.com
Tue Jun 28 13:58:36 EDT 2011
Try looking at Mono.Options (aka NDesk.Options)
That works quite well for me.
Oh.. You don't have a main in repl that gets argv...
Are the command line arguments stored in the environment somewhere?
Ian
On 28 Jun 2011, at 18:59, "Steve Lessard" <s_lessard at yahoo.com> wrote:
> Hi,
>
> I'm trying to write a shell script in C# using the csharp REPL. The
> script below works fine as is on OS X, but I would like to pass an
> argument into this script. I haven't been able to find any docs on how
> to do this and all of my experiments have turned up nothing. Is
> there a
> way to pass an argument into the csharp REPL?
>
> I'm running Mono version 2.10.2 with Mono C# compiler version 4.0.0.0
>
> -SteveL
>
>
> #!/usr/bin/env csharp -lib:$PWD
>
> // Initialize the "epoch"
> // The "epoch" is 12:00:00 AM UTC, January 1, 1970
> DateTime epoch = new DateTime().AddYears(1969).AddHours(-8);
>
> TimeSpan nowDiff = (DateTime.Now - epoch);
> System.Console.WriteLine("Current Time (Total Seconds): " +
> nowDiff.TotalSeconds);
> System.Console.WriteLine("Current Local Time: " +
> epoch.AddSeconds(nowDiff.TotalSeconds).ToString());
> System.Console.WriteLine("Current UTC Time: " +
> epoch.AddSeconds(nowDiff.TotalSeconds).ToUniversalTime().ToString());
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
More information about the Mono-list
mailing list