forked from MidnightCommander/mc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmc.menu
324 lines (294 loc) · 7.72 KB
/
mc.menu
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
shell_patterns=0
+ ! t t
@ Do something on the current file
CMD=%{Enter command}
$CMD %f
+ t t
@ Do something on the tagged files
set %t; CMD=%{Enter command}
while [ -n "$1" ]; do
$CMD "$1"
shift
done
0 Edit a bug report and send it to root
${EDITOR-vi} /tmp/mail.$$
test -r /tmp/mail.$$ && mail root < /tmp/mail.$$
rm -f /tmp/mail.$$
=+ f \.1$ | f \.3$ | f \.4$ | f \.5$ | f \.6$ | f \.7$ | f \.8$ | f \.man$ & t r
1 Display the file with roff -man
nroff -man %f | less
2 Call the info hypertext browser
info
= t d
3 Compress the current subdirectory (tar.gz)
Pwd=`basename "%d" /`
echo -n "Name of the compressed file (without extension) [$Pwd]: "
read tar
if [ "$tar"x = x ]; then tar="$Pwd"; fi
cd .. && \
tar cf - "$Pwd" | gzip -f9 > "$tar.tar.gz" && \
echo "../$tar.tar.gz created."
4 Compress the current subdirectory (tar.bz2)
Pwd=`basename %d /`
echo -n "Name of the compressed file (without extension) [$Pwd]: "
read tar
if [ "$tar"x = x ]; then tar="$Pwd"; fi
cd .. && \
tar cf - "$Pwd" | bzip2 -f --repetitive-best > "$tar.tar.bz2" && \
echo "../$tar.tar.bz2 created."
= f \.c$ & t r
+ f \.c$ & t r & ! t t
5 Compile and link current .c file
make `basename %f .c` 2>/dev/null || cc -O -o `basename %f .c` %f
+ t r & ! t t
a Append file to opposite
cat %f >>%D/%f
+ t t
A Append files to opposite files
set %t
while [ -n "$1" ]; do
cat $1 >>%D/$1
shift
done
+ t r & ! t t
d Delete file if a copy exists in the other directory.
if [ "%d" = "%D" ]; then
echo "The two directores must be different"
exit 1
fi
if [ -f %D/%f ]; then # if two of them, then
if cmp -s %D/%f %f; then
rm %f && echo %f: DELETED
else
echo "%f and %D/%f differ: NOT deleted"
echo -n "Press RETURN "
read key
fi
else
echo %f: No copy in %D/%f: NOT deleted.
fi
+ t t
D Delete tagged files if a copy exists in the other directory.
if [ "%d" = "%D" ]; then
echo "The two directores must be different"
exit 1
fi
for i in %t
do
if [ -f %D/$i ]; then
SUM1="`sum $i`"
SUM2="`sum %D/$i`"
if [ "$SUM1" = "$SUM2" ]; then
rm $i && echo ${i}: DELETED
else
echo $i and %D/$i differ: NOT deleted.
fi
else
echo %f has no copy in %D/%f: NOT deleted.
fi
done
= f \.gz$ & t r
+ ! t t
n Inspect gzip'ed newsbatch file
dd if=%f bs=1 skip=12|zcat|${PAGER-more}
# assuming the cunbatch header is 12 bytes long.
= t r &
+ ! t t
h Strip headers from current newsarticle
CHECK=`awk '{print $1 ; exit}' %f` 2>/dev/null
case $CHECK in
Newsgroups:|Path:)
cp %f /tmp/%f.$$ && sed '/^'"$CHECK"' /,/^$/d' /tmp/%f.$$ > %f
[ "$?" = "0" ] && rm /tmp/%f.$$
echo %f: header removed
;;
*)
echo %f is not a news article.
;;
esac
+ t t
H Strip headers from the marked newsarticles
set %t
while [ -n "$1" ]; do
CHECK=`awk '{print $1 ; exit}' $1` 2>/dev/null
WFILE=/tmp/${1}.$$
case $CHECK in
Newsgroups:|Path:)
cp $1 $WFILE && sed '/^'"$CHECK"' /,/^$/d' $WFILE > $1
if [ "$?" = "0" ]; then
rm $WFILE; echo $1 header removed. OK.
else
echo "Oops! Please check $1 against $WFILE"
fi
;;
*)
echo $1 skipped: Not a news article.
;;
esac
shift
done
= t r
+ ! t t
r Copy file to remote host
echo -n "To which host?: "
read Host
echo -n "To which directory on $Host?: "
read Dir
rcp -p %f ${Host}:$Dir
+ t t
R Copy files to remote host (no error checking)
echo -n "Copy files to which host?: "
read Host
echo -n "To which directory on $Host? :"
read Dir
rcp -pr %u ${Host}:$Dir
= f \.tex$ & t r
+ f \.tex$ & t r & ! t t
t Run latex on file and show it with xdvi
latex %f && xdvi `basename %f .tex`.dvi
=+ f ^part | f ^Part | f uue & t r
+ t t
U Uudecode marked news articles (needs work)
set %t
(
while [ -n "$1" ]; do # strip headers
FIRST=`awk '{print $1 ; exit}' $1`
cat $1 | sed '/^'"$FIRST"' /,/^$/d'; shift
done
) |sed '/^$/d' |sed -n '/^begin 6/,/^end$/p' | uudecode
if [ "$?" != "0" ]; then
echo "Could not decode %t"
fi
echo "Please test the output file before deleting anything"
=+ f \.tar\.gz$ | f \.tar\.z$ | f \.tgz$ | f \.tpz$ | f \.tar\.Z$| f \.tar\.bz2$ & t r
x Extract the contents of a compressed tar file
unset EXT
case %f in
*.tar.bz2) EXT=tar_bz2;;
esac
if [ "$EXT" = "tar_bz2" ]; then
bunzip2 -c %f | tar xvf -
else
gzip -dc %f | tar xvf -
fi
= t r
+ ! t t
y Gzip or gunzip current file
unset DECOMP
case %f in
*.gz) DECOMP=-d;;
*.[zZ]) DECOMP=-d;;
esac
gzip $DECOMP -v %f
+ t t
Y Gzip or gunzip tagged files
for i in %t
do
unset DECOMP
case $i in
*.gz) DECOMP=-d;;
*.[zZ]) DECOMP=-d;;
esac
gzip $DECOMP -v $i
done
+ ! t t
b Bzip2 or bunzip2 current file
unset DECOMP
case %f in
*.bz2) DECOMP=-d;;
esac
bzip2 $DECOMP -v %f
+ t t
B Bzip2 or bunzip2 tagged files
for i in %t
do
unset DECOMP
case $i in
*.bz2) DECOMP=-d;;
esac
bzip2 $DECOMP -v $i
done
+ f \.tar.gz$ | f \.tgz$ | f \.tpz$ | f \.tar.Z$ | f \.tar.z$ | f \.tar.bz2$ | f \.tar.F$ & t r & ! t t
z Extract compressed tar file to subdirectory
unset D
set gzip -cd
case %f in
*.tar.gz) D="`basename %f .tar.gz`";;
*.tgz) D="`basename %f .tgz`";;
*.tpz) D="`basename %f .tpz`";;
*.tar.Z) D="`basename %f .tar.Z`";;
*.tar.z) D="`basename %f .tar.z`";;
*.tar.bz2) D="`basename %f .tar.bz2`"; set bunzip2 -c ;;
*.tar.F) D="`basename %f .tar.F`"; set freeze -dc;
esac
mkdir $D; cd $D && ($1 $2 ../%f | tar xvf -)
+ t t
Z Extract compressed tar files to subdirectories
for i in %t
do
set gzip -dc
unset D
case $i in
*.tar.gz) D="`basename $i .tar.gz`";;
*.tgz) D="`basename $i .tgz`";;
*.tpz) D="`basename $i .tpz`";;
*.tar.Z) D="`basename $i .tar.Z`";;
*.tar.z) D="`basename $i .tar.z`";;
*.tar.F) D="`basename $i .tar.F`"; set freeze -dc;;
*.tar.bz2) D="`basename $i .tar.bz2`"; set bunzip2 -c;;
esac
mkdir $D; (cd $D && $1 $2 ../$i | tar xvf -)
done
+ f \.gz$ | f \.tgz$ | f \.tpz$ | f \.Z$ | f \.z$ | f \.bz2$ & t r & ! t t
c Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2
unset D
case %f in
*.tgz) EXT=tgz;;
*.tpz) EXT=tpz;;
*.Z) EXT=Z;;
*.z) EXT=z;;
*.gz) EXT=gz;;
*.bz2) EXT=bz2;;
esac
case $EXT in
tgz|tpz) D="`basename %f .$EXT`.tar";;
gz|Z|z) D="`basename %f .$EXT`";;
bz2) D="`basename %f .bz2`";;
esac
if [ "$EXT" = "bz2" ]; then
bunzip2 -v %f ; gzip -f9 -v $D
else
gunzip -v %f ; bzip2 -v --repetitive-best $D
fi
+ t t
C Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2
set %t
while [ -n "$1" ]
do
unset D
case $1 in
*.tgz) EXT=tgz;;
*.tpz) EXT=tpz;;
*.Z) EXT=Z;;
*.z) EXT=z;;
*.gz) EXT=gz;;
*.bz2) EXT=bz2;;
esac
case $EXT in
tgz) D="`basename $1 .tgz`.tar";;
tpz) D="`basename $1 .tpz`.tar";;
gz|Z|z) D="`basename $1 .$EXT`";;
bz2) D="`basename $1 .bz2`";;
esac
if [ "$EXT" = "bz2" ]; then
bunzip2 -v $1
gzip -f9 -v $D
else
gunzip -v $1
bzip2 -v --repetitive-best $D
fi
shift
done
+ x /usr/bin/open | x /usr/local/bin/open & x /bin/sh
o Open next a free console
open -s -- sh