Revision 1120,
760 bytes
checked in by daisuke, 14 years ago
(diff) |
import vutils-2.2.4 from internal cvs repository
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | # del by Jun Nishii <jun@vinelinux.org> |
---|
3 | # Time-stamp: <2000-08-16 03:14:59 vine> |
---|
4 | |
---|
5 | ShowUsage() { |
---|
6 | cat <<EOF |
---|
7 | Remove files after listing them. |
---|
8 | Usage: ${1##/*/} <option> files |
---|
9 | option) |
---|
10 | -h: show this usage |
---|
11 | Other option is passed to rm command. |
---|
12 | EOF |
---|
13 | } |
---|
14 | |
---|
15 | CheckOption() { |
---|
16 | if [ $# = 0 ] ; then |
---|
17 | ShowUsage ${0##*/} |
---|
18 | exit -1 |
---|
19 | fi |
---|
20 | } |
---|
21 | |
---|
22 | for arg in $1 ; do |
---|
23 | case $arg in |
---|
24 | -h) ShowUsage; exit 0 ;; |
---|
25 | -*) option=$1 ; shift ;; |
---|
26 | esac |
---|
27 | done |
---|
28 | |
---|
29 | CheckOption $* |
---|
30 | |
---|
31 | FILES=`ls -dF --color=auto $* 2>/dev/null` |
---|
32 | if [ -z "${FILES}" ]; then |
---|
33 | echo "no such file: " $* |
---|
34 | exit 1 |
---|
35 | fi |
---|
36 | echo $FILES |
---|
37 | echo -n "really remove them? [yiN] " |
---|
38 | read answer |
---|
39 | case ${answer:-"n"} in |
---|
40 | y)rm -f $option $* ; echo "ok, removed...." ;; |
---|
41 | i)rm -i $option $* ;; |
---|
42 | *) echo "canceled..." ;; |
---|
43 | esac |
---|
44 | |
---|
45 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.