> I use Linux. So, will the file extension be a factor here?

Yes, NimScript requires a `.nims` extension. Personally, I think `nim 
whatever.nims` should require the extension and `nim e whatever.nims` should 
support any extension, but the current behavior is to require `.nims` in both 
cases.

The [nimscript](https://nim-lang.org/docs/nimscript.html) module has procs that 
do what you want. You can use 
[paramStr](https://nim-lang.org/docs/nimscript.html#paramStr%2Cint) and 
[paramCount](https://nim-lang.org/docs/nimscript.html#paramCount) to handle 
parameters. 
[readLineFromStdin](https://nim-lang.org/docs/nimscript.html#readLineFromStdin) 
or 
[readAllFromStdin](https://nim-lang.org/docs/nimscript.html#readAllFromStdin) 
for reading from stdin. 
[exec](https://nim-lang.org/docs/nimscript.html#exec%2Cstring) to execute 
system commands. `echo` will write to stdout.

> Will '#!/usr/bin/env nim' take care of the compilation of the script?

NimScript isn't compiled, it's interpreted. Nim includes a VM to support 
compile time evaluation (required for macros and such), and that VM is also 
used for NimScript. Not all Nim features are available from NimScript. See 
[https://nim-lang.org/docs/nims.html](https://nim-lang.org/docs/nims.html) for 
more details. 

Reply via email to