mirror of
https://github.com/vlang/v.git
synced 2025-09-18 11:56:57 -04:00
Updated V for Bash script developers (markdown)
parent
b77b961752
commit
2a585dadfc
@ -6,7 +6,7 @@ By doing so, v will make functions inside the os module automatically available
|
|||||||
|
|
||||||
You also will not need to specify the main function (that is a work in progress, for now, please do so ... simple linear examples work, but for now v scripting is more stable with a `fn main(){}` ).
|
You also will not need to specify the main function (that is a work in progress, for now, please do so ... simple linear examples work, but for now v scripting is more stable with a `fn main(){}` ).
|
||||||
|
|
||||||
To run your .vsh scripts, on *nix platforms, just set the executable bit for your script with for example `chmod +x script.vsh` . After that, you can start the script like any other executable, with `./script.vsh` .
|
To run your .vsh scripts, on \*nix platforms, just set the executable bit for your script with for example `chmod +x script.vsh` . After that, you can start the script like any other executable, with `./script.vsh` .
|
||||||
|
|
||||||
On Windows, you have to associate the `.vsh` file extension with `v.exe` . After that, just double click your `script.vsh` file in Windows Explorer.
|
On Windows, you have to associate the `.vsh` file extension with `v.exe` . After that, just double click your `script.vsh` file in Windows Explorer.
|
||||||
|
|
||||||
@ -14,33 +14,39 @@ On Windows, you have to associate the `.vsh` file extension with `v.exe` . After
|
|||||||
<tr><td colspan="2" align="center">Hello World</td></tr>
|
<tr><td colspan="2" align="center">Hello World</td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<pre class="highlight highlight-source-v">
|
|
||||||
|
```bash
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
echo "Hello world"
|
echo "Hello world"
|
||||||
</pre>
|
```
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td valign="top">
|
<td valign="top">
|
||||||
<pre>
|
|
||||||
|
```v
|
||||||
#!/usr/local/bin/v
|
#!/usr/local/bin/v
|
||||||
println('Hello World!')
|
println('Hello World!')
|
||||||
</pre>
|
```
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr><td colspan="2" align="center">Listing files in current folder</td></tr>
|
<tr><td colspan="2" align="center">Listing files in current folder</td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<pre>
|
|
||||||
|
```bash
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
ls
|
ls
|
||||||
</pre>
|
```
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td valign="top">
|
<td valign="top">
|
||||||
<pre>
|
|
||||||
|
```v
|
||||||
#!/usr/local/bin/v
|
#!/usr/local/bin/v
|
||||||
println(ls('.') ?)
|
println(ls('.') ?)
|
||||||
</pre>
|
```
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user