| 1 | #!/bin/sh |
| 2 | v run $@ |
| 3 | |
| 4 | ## The purpose of this script, is to make it easier to run V scripts on systems, where |
| 5 | ## the `/usr/bin/env` implementation, does not yet support a `-S` option. |
| 6 | ## Notes: FreeBSD's env supports it since 2006. |
| 7 | ## GNU's coreutils env supports it since 2018. |
| 8 | ## BusyBox's env does not support it (2025/02/04). |
| 9 | ## OpenBSD's env does not support it (2026/01/14). |
| 10 | ## And there may be others like it too :-| . |
| 11 | |
| 12 | ## On such systems, you can copy this script, or symlink it, somewhere in your PATH, |
| 13 | ## and then start your .vsh scripts with: `#!/usr/bin/env vrun`. |
| 14 | ## You can also start them with `#!/usr/bin/env /full/path/to/v/cmd/tools/vrun`, or |
| 15 | ## even just `#!/full/path/to/v run` directly, if you prefer. |
| 16 | |
| 17 | ## You can check, if it works, by saving this as a /tmp/args.vsh file: |
| 18 | ## ```v |
| 19 | ## !/usr/bin/env vrun |
| 20 | ## println(arguments()) |
| 21 | ## ``` |
| 22 | ## |
| 23 | ## ... then run `chmod 755 /tmp/args.vsh`, and finally run: |
| 24 | ## `/tmp/args.vsh abc 123` |
| 25 | ## |
| 26 | ## If everything works correctly, you should see something like: |
| 27 | ## ['/tmp/args', 'abc', '123'] |
| 28 | |