-
Notifications
You must be signed in to change notification settings - Fork 1
/
chmod.1
178 lines (127 loc) · 6.11 KB
/
chmod.1
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
CHMOD(1) Human68k ITA TOOLBOX User's Manual CHMOD(1)
名称
chmod - ファイルやディレクトリの属性を変更する
形式
chmod [ -cdfvR ] expression name ...
解説
chmod は,ファイルやディレクトリの属性を expression に従って
変更します.name ... は対象のファイルやディレクトリのパス名
の並びです.これらは左から右に順番に処理され,もし途中でエラー
があっても処理は最後まで続行されます.
expression には,8進数値表現とシンボル表現との 2とおりの指定
形式があります.
シンボル表現の expression は,‘+’,‘-’,あるいは‘=’の
いずれかのオペレータに,属性の各ビットを表す文字‘ashrwx’の
組み合わせが続くものです.
‘+’は,続く属性を加えることを指示するオペレータです.‘-’
は,続く属性を取り除きます.‘=’は,続く属性の組み合わせを
そのままファイルの属性とします.
オペレータに続く属性選択文字の意味は次のとおりです.
a 保管ファイル (*1)
s システムファイル
h 隠しファイル
r 読み出し可 (*2)
w 書き込み可
x 実行可 (*3)
*1 Human68k では,この属性は「通常のファイル」を意味
します.
*2 実際には効果はありません.どのような指定を行っても,
ファイルは必ず「読み出し可」となります.
*3 この属性は,特定の環境においてのみ参照されます.
たとえば‘+x’は各ファイルに実行許可を与え,‘-sh’は各ファ
イルからシステムファイル属性と隠しファイル属性とを取り除きま
す.‘=arw’は,各ファイルの属性を「保管ファイル,非システム
ファイル,非隠しファイル,読み出し可,書き込み可,実行不可」
とします.
オペレータと属性選択文字との組み合わせを複数個連結することが
できます.たとえば‘+x-w’は,各ファイルに実行許可を与え,書
き込み許可を取り除きます.
最初のオペレータの直前には,文字‘ugoa’の組み合わせを
置くことができます(例:‘ug+x-w’).この組み合わせをさ
らに‘,’で区切って連結することができます(例:
‘ug+x-w,o+h’).これは UNIX との互換のために許された
記法です.Human68k においては,オペレータの直前の文字
‘ugoa’の組み合わせや区切文字‘,’は無視されます.たと
えば‘ug+x-w,o+h’は‘+x-w+h’として解釈されます.
シンボル表現の expression の解釈は,左から右に向かって順に行
われます.たとえば‘-w+x+w’は‘+x+w’と同じことになります.
したがって‘=’よりも左での指定は結果的にすべて無効になりま
す.
8進数値表現の expression は,8進表記の数値でファイルの属性を
直接的に指定するものです.任意の桁数の 8進数を記述することが
できますが,下位 3桁分のみが有効であり,この 3つの各桁ごとの
論理和で求められる 1桁の 8進数(たとえば 755 は 7,210 は 3)
が属性を指定することになります.この 1桁の 8進数は次の属性の
論理和を表します.
4 読み出し可 (*2)
2 書き込み可
1 実行可 (*3)
たとえば 7 では,読み出し,書き込み,実行のすべてが許され,6
では実行以外が許されることになります.
8進数値表現の expression では,保管ファイル属性(a),システム
ファイル属性(s),および隠しファイル属性(h)を変更することはで
きません.これらは元のまま保存されます.
chmod には次のオプションがあります.
-c 属性が変化した場合にのみ,そのファイルのパス名と変化後
の属性とを標準出力に出力します.
-d name が沖版 lndrv によるシンボリック・リンクである場合,
通常はリンクが参照しているファイルが対象となりますが,
-d オプションを指定するとシンボリック・リンクは処理され
ません(無視されます).
-f 各 name の処理中にエラーが起こっても,エラー・メッセー
ジを出力しません(ただし終了ステータスは 2 が返ります).
また,ファイル引数が 1つも無くてもエラーとしません.
-v 各 name のパス名と変更後の属性,また,それは元の属性か
ら変化したのか,それとも元のままであるのかの報告を標準
出力に出力します.このオプションの効力は,-c オプション
を上回ります.
-R name がディレクトリである場合には,そのディレクトリの属
性を変更した後,そのディレクトリ以下のファイルやディレ
クトリの属性も再帰的に変更します.
オプションは -c -R のようにそれぞれ単独に記述することもでき
ますし,-cR のように連結して指定することもできます.
-c オプションや -v オプションで報告される属性は,次に示す 7
桁のシンボルで表されます.
□□□□□□□
|||||||
|||||| \
||||| \ x : 実行可,- : 実行不可
|||| \ w : 書き込み可,- : 書き込み不可
||| \ r : 読み出し可,- : 読み出し不可
|| \ h : 隠しファイル,- : 非隠しファイル
| \ s : システムファイル,- : 非システムファイル
| a : 保管ファイル,- : 非保管ファイル
\
v : ボリュームラベル
d : ディレクトリ
- : 通常のファイル
関連事項
ls(1)
診断
何らかのエラーがあったときにはエラー・メッセージが標準エラー
出力に出力されます(ただし -f オプションが指定された場合には,
各ファイルに対する処理中のエラーは出力されません).
終了ステータスとしては,引数の記述に間違いがあった場合には 1,
各引数の処理中に何らかのエラーが 1度でもあった場合には 2,メ
モリ不足など,システムの原因により正常に実行ができなかった場
合には 3,すべてが正常に終了したならば 0 が返ります.^C など
によって中断したときの終了ステータスは OS の仕様によります.
注意
expression は単一の引数でなければなりません.
属性選択文字‘r’は無視されます.
属性の組み合わせの中には,標準のシステムでは未定義となってい
るものがあります.
制約
ルート・ディレクトリの属性を変更することはできません.これは
仮想ドライブのルート・ディレクトリについても同じです.
不具合
メディアがセットされていないドライブのカレント・ディレクトリ
は / であると見なされて処理が進みます.
ディレクトリの属性を変更しても,そのディレクトリを指す . や
.. のエントリが保持する属性は変化しません.
ディレクトリの再帰の回数は64回に制限されています.
バージョン
1.4
制作・著作
Copyright(C)1992-93 by 板垣 史彦 (Itagaki Fumihiko)
1.4 Last change: 25 Aug 1993 Itagaki Fumihiko