-
Notifications
You must be signed in to change notification settings - Fork 1
/
rm.1
136 lines (95 loc) · 4.67 KB
/
rm.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
RM(1) Human68k ITA TOOLBOX User's Manual RM(1)
名称
rm - ファイルやディレクトリを削除する
形式
rm [ -firvR ] [ -- ] name ...
解説
ファイルやディレクトリを削除します.name ... は削除するファ
イルやディレクトリのパス名の並びです.これらは左から右に順番
に処理され,もし途中でエラーがあっても処理は最後まで続行され
ます.
name が沖版 lndrv によるシンボリック・リンクである場合にも
name そのものが削除され,リンクが参照しているファイルやディ
レクトリには影響は及びません.
ディレクトリを削除するには -r オプションか -R オプションを指
定しなければなりません.
削除しようとするファイルが,ボリューム・ラベル,書き込み禁止,
隠し,システム,のいずれかの属性を持っている場合,rm は確認
メッセージを表示して 1行入力待ちとなります.ここで‘y’で始
まる行を入力するとそのファイルは削除され,それ以外の入力では
削除されません.また,-r(または -R)オプションが指定され,
書き込み禁止属性を持っている,空でないディレクトリの下に進も
うとする場合にも,rm は確認メッセージを表示して 1行入力待ち
となります.ここで‘y’で始まる行を入力するとそのディレクト
リの下に進み,それ以外の入力では,そのディレクトリはスキップ
されます.ただし,これらの問い合わせは,標準入力がキャラクタ・
デバイスでないときや -f オプションが指定されているときには行
われず,無条件に処理が行われます.
rm には次のオプションがあります.
-f どのような場合にも一切の問い合わせを行わず,ファイ
ルやディレクトリを無条件に削除します.また,存在し
ないエントリを指定するファイル引数は無視し,ファイ
ル引数が 1つも無くてもエラーとしません.
-i すべての対象ファイルについて,それを削除するかどう
かの問い合わせが行われます.-r(または -R)オプショ
ンが指定されているときには,すべての空でない対象ディ
レクトリについて,そのディレクトリの下に処理を進め
るかどうかが問い合わされ,さらに,空になった(ある
いはもともと空である)ディレクトリを削除するかどう
かの問い合わせが行われます.
これらの問い合わせに対して‘y’で始まる行を入力す
ると処理が行われ,それ以外の入力では処理はスキップ
されます.
-r, -R name がディレクトリである場合には,そのディレクト
リ以下のファイルやディレクトリを再帰的にまるごと削
除します.
-v ファイルやディレクトリを削除する直前に,そのパス名
を標準出力に出力します.
-i オプションと -f オプションの両方を指定した場合には,最後
に指定した一方のみが有効となります.
オプションは -f -r のようにそれぞれ単独に記述することもでき
ますし,-fr のように連結して指定することもできます.
引数‘--’は,残りの引数を非オプション引数とします.引数‘-’
は非オプション引数と見なされます.
関連事項
rmdir(1)
診断
何らかのエラーがあったときにはエラー・メッセージが標準エラー
出力に出力されます.
終了ステータスとしては,引数の記述に間違いがあった場合には 1,
各引数の処理中に何らかのエラーが 1度でもあった場合には 2,メ
モリ不足など,システムの原因により正常に実行ができなかった場
合には 3,すべてが正常に終了したならば 0 が返ります.^C など
によって中断したときの終了ステータスは OS の仕様によります.
制約
次のような引数はエラー(“名前が無効です”)となります.
1 ‘?:’(? は 1文字でドライブを示す)
2 ‘/’および‘\’
3 ‘.’および‘..’
4 1~3 を組み合わせた引数
これは安全のためです.
警告
たとえば,シェルで
rm -r .*
とタイプすると,引数には‘.’と‘..’とが含まれてしまうこと
になりますが,この 2つは ITA TOOLBOX の rm ではエラーとなっ
て処理されませんので,‘.’で始まるその他のファイルやディレ
クトリのみを削除することができます.しかし,このような操作は
あまりお勧めできません.他のコマンドや他のシステムでうっかり
同じような操作をしてしまうと,悲惨な結果を招きかねません.
いずれにしても,シェルのワイルド・カードには十分に注意してく
ださい.また,現在の作業ディレクトリがどこであるのかをしっか
り把握しておくことも大切です.
少しでも不安があるときには -i オプションを使用すると良いでしょ
う.とにかく,あせらず確実に行うべきです.
単純なタイプ・ミスにもまた十分に注意してください.たとえばエ
ディタ em を起動しようとして‘em’とタイプするところを‘rm’
とタイプしてしまっては,ファイルを編集するどころか抹消してし
まうことになります.
不具合
ディレクトリの再帰の回数は32回に制限されています.
バージョン
1.4
制作・著作
Copyright(C)1992-93 by 板垣 史彦 (Itagaki Fumihiko)
1.4 Last change: 27 Jan 1993 Itagaki Fumihiko