Re: OT: the rm bug hit me again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joe Klemmer <klemmerj@xxxxxxxxxxx> writes:

>  	I alomst hate to admit it but the rm bug bit me for the second time
> # rm -fR mozilla *

Being On Topic: the propensity of distributions like Fedora to
alias rm='rm -i' 
leads to hassles when it is not needed and a disasterous habit
of using rm -f.

I use this:

export RM_NUM_CONFIRM=11
function FRM_CONF () 
{
    local rm_ok="y"
    local rqual="-d --"
    local q
    for q do 
        case "$q" in
          --)
            break
            ;;
          --recursive)
            rqual="-RA --"
            break
            ;;
          --*)
            ;;
          -*[rR]*) 
            rqual="-RA --"
            break
            ;;
        esac
    done
    local num_rm=$[$(ls 2>/dev/null $rqual $@ | wc -w)]
    if [ "$num_rm" -ge "$RM_NUM_CONFIRM" ]
    then
       echo -n "Remove (approx) $num_rm files OK? "
       read rm_ok
    fi
    if [ "z$rm_ok" = "zy" -o "z$rm_ok" = "zY" ]
    then
       \rm "$@"
    fi
}
alias rm=FRM_CONF


Not perfect, but quite nice.


-- 
Donald Arseneau                          asnd@xxxxxxxxx

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux