[Mono-list] csharp REPL scripts

Steve Lessard s_lessard at yahoo.com
Sat Mar 5 08:10:47 EST 2011


Yes, both Miguel's solution and Ian's solution work. I pretty much understand 
why Miguel's solution works. As for Ian's solution I read the man page for env 
but it's not clear as to what env does that makes Ian's solution work. Would you 
care to share a short explanation?




________________________________
From: Ian Norton <Ian.Norton-Badrul at thales-esecurity.com>
To: Miguel de Icaza <miguel at novell.com>
Cc: Steve Lessard <s_lessard at yahoo.com>; Mono <Mono-list at lists.ximian.com>
Sent: Fri, March 4, 2011 10:44:28 PM
Subject: Re: [Mono-list] csharp REPL scripts

Would

#!/usr/bin/env csharp

Work?

Ian

On 5 Mar 2011, at 01:29, "Miguel de Icaza" <miguel at novell.com> wrote:

> Hello,
>
>    Seems to be a problem with the way OSX launches the program, try
> this instead for the first line:
>
> #!/usr/bin/mono
> /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.0/ 
> csharp.exe
>
>
> On Thu, Mar 3, 2011 at 1:10 PM, Steve Lessard <s_lessard at yahoo.com>  
> wrote:
>> I read in the release notes for Mono 2.10
>> (http://www.mono-project.com/Release_Notes_Mono_2.10) that "the C#  
>> REPL now
>> can
>> be used as a program to run C# scripts in Unix. Your Unix scripts  
>> can now
>> contain as their first line the #!/usr/bin/csharp line which allows  
>> you to
>> create C# scripts that can be treated like programs."  The release  
>> notes
>> give
>> this very simple demo:
>>
>> $ echo '#!/usr/bin/csharp' > demo
>> $ echo 'System.Console.WriteLine (10+2);' >> demo
>> $ chmod +x demo
>> $ ./demo
>> 12
>> $
>>
>> So I tried it on my machine running 2.10.1, but it always fails  
>> with a
>> syntax
>> error. (See below.) Is anyone else able to run this simple demo of  
>> the C#
>> REPL?
>> tools$ echo '#!/usr/bin/csharp' > demo
>> tools$ echo 'System.Console.WriteLine (10+2);' >> demo
>> tools$ chmod +x demo
>> tools$ ./demo
>> ./demo: line 2: syntax error near unexpected token `10+2'
>> ./demo: line 2: `System.Console.WriteLine (10+2);'
>> tools$
>>
>> -SteveL
>>
>>
>>
>> $ uname -a
>> Darwin applejacks 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10  
>> 18:13:17
>> PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386
>> $ mono --version
>> Mono JIT compiler version 2.10.1 (tarball Fri Feb 25 15:56:49 MST  
>> 2011)
>> Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
>> TLS:           normal
>> SIGSEGV:       normal
>> Notification:  Thread + polling
>> Architecture:  x86
>> Disabled:      none
>> Misc:          debugger softdebug
>> LLVM:          yes(2.9svn-mono)
>> GC:            Included Boehm (with typed GC)
>> $ /usr/bin/csharp --version
>> Mono C# compiler version 4.0.0.0
>>
>>
>>
>>
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
>>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20110305/4b3722ab/attachment.html 


More information about the Mono-list mailing list