source: projects/vutils/trunk/del @ 1120

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
5ShowUsage() {
6cat <<EOF
7Remove files after listing them.
8Usage: ${1##/*/} <option> files
9    option)
10        -h: show this usage
11        Other option is passed to rm command.
12EOF
13}
14
15CheckOption() {
16if [ $# = 0 ] ; then
17    ShowUsage ${0##*/}
18    exit -1
19fi
20}
21
22for arg in $1 ; do
23    case $arg in
24        -h) ShowUsage; exit 0 ;;
25        -*) option=$1 ;         shift       ;;
26        esac
27done
28
29CheckOption $*
30
31FILES=`ls -dF --color=auto $* 2>/dev/null`
32if [ -z "${FILES}" ]; then
33        echo "no such file: " $*
34        exit 1
35fi
36echo $FILES
37echo -n "really remove them? [yiN] "
38read answer
39case ${answer:-"n"} in
40        y)rm -f $option $* ;    echo "ok, removed...." ;;
41        i)rm -i $option $* ;;
42*) echo "canceled..." ;;
43esac
44
45exit 0
Note: See TracBrowser for help on using the repository browser.