-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path586.html
More file actions
74 lines (71 loc) · 2.21 KB
/
Copy path586.html
File metadata and controls
74 lines (71 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<h1 id="chmod">CHMOD</h1>
<blockquote>
<p>CHMOD file, mode</p>
</blockquote>
<p>Change permissions of a file. The string <code>file</code> holds the
file name and follows OS file naming conventions. <code>mode</code>
provides the file permission and must be compatible with system call
chmod()‘s ’mode’ parameter.</p>
<p>See ACCESS to get information on file permissions.</p>
<h2 id="linux">Linux</h2>
<p><code>mode</code> is a number best represented in octal: 0oUGO with
U: User; G: Group; O: Other</p>
<p>U, G and O are each defined the following way:</p>
<table>
<thead>
<tr class="header">
<th style="text-align: center;">Value</th>
<th style="text-align: center;">Permission</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;">0</td>
<td style="text-align: center;">no</td>
</tr>
<tr class="even">
<td style="text-align: center;">1</td>
<td style="text-align: center;">x (execute)</td>
</tr>
<tr class="odd">
<td style="text-align: center;">2</td>
<td style="text-align: center;">w (write)</td>
</tr>
<tr class="even">
<td style="text-align: center;">3</td>
<td style="text-align: center;">w + x</td>
</tr>
<tr class="odd">
<td style="text-align: center;">4</td>
<td style="text-align: center;">r (read)</td>
</tr>
<tr class="even">
<td style="text-align: center;">5</td>
<td style="text-align: center;">r + x</td>
</tr>
<tr class="odd">
<td style="text-align: center;">6</td>
<td style="text-align: center;">r + w</td>
</tr>
<tr class="even">
<td style="text-align: center;">7</td>
<td style="text-align: center;">r + w + x</td>
</tr>
</tbody>
</table>
<h3 id="example">Example</h3>
<pre><code>' Make myfile available to anyone (read/write)
CHMOD "myfile.bas", 0o666
' Make myfile available to anyone (execute/read/write)
CHMOD "myfile.bas", 0o777
' Make myfile available to user (read/write)
' All others only read
CHMOD "myfile.bas", 0o644</code></pre>
<h2 id="windows">Windows</h2>
<p>in Windows the read-only flag can be set with <code>mode = 1</code>
and unset with <code>mode = -1</code></p>
<h3 id="example-1">Example</h3>
<pre><code>' Make myfile read-only
CHMOD "myfile.bas", 1
' Make myfile read and write
CHMOD "myfile.bas", -1</code></pre>