You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Unix systems, you can use `#!/usr/bin/env rust-script` as a shebang line in a Rust script. This will allow you to execute a script file directly.
99
+
On Unix systems, you can use `#!/usr/bin/env rust-script` as a shebang line in a Rust script. This will allow you to execute a script files (which don't need to have the `.rs`file extension) directly.
100
100
101
-
If you are using Windows, you can associate the `.crs` extension (which is simply a renamed `.rs` file) with `rust-script`. This allows you to execute Rust scripts simply by naming them like any other executable or script.
101
+
If you are using Windows, you can associate the `.ers` extension (executable Rust - a renamed `.rs` file) with `rust-script`. This allows you to execute Rust scripts simply by naming them like any other executable or script.
102
102
103
-
This can be done using the `rust-script --install-file-association` command. It will also allow you to execute `.crs` scripts *without* having to specify the file extension, in the same way that `.exe` and `.bat` files can be used.
103
+
This can be done using the `rust-script --install-file-association` command. It will also allow you to execute `.ers` scripts *without* having to specify the file extension, in the same way that `.exe` and `.bat` files can be used.
104
104
105
105
Uninstall the file association with `rust-script --uninstall-file-association`.
106
106
107
-
If you want to make a script usable across platforms, use *both* a hashbang line *and* give the file a `.crs` file extension.
107
+
If you want to make a script usable across platforms, use *both* a hashbang line *and* give the file a `.ers` file extension.
108
108
109
109
## Expressions
110
110
@@ -127,7 +127,7 @@ The code given is embedded into a block expression, evaluated, and printed out u
127
127
You can use `rust-script` to write a quick filter, by specifying a closure to be called for each line read from stdin, like so:
You can achieve a similar effect to the above by using the `--count` flag, which causes the line number to be passed as a second argument to your closure:
139
139
140
140
```sh
141
-
$ cat now.crs| rust-script --count --loop \
141
+
$ cat now.ers| rust-script --count --loop \
142
142
"|l,n| println!(\"{:>6}: {}\", n, l.trim_right())"
0 commit comments