[Mono-list] csharp REPL scripts
Steve Lessard
s_lessard at yahoo.com
Thu Mar 3 13:10:29 EST 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20110303/12f76bd3/attachment.html
More information about the Mono-list
mailing list