bug-fileutils
[Top][All Lists]
Advanced

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

rm and ln enhancements -- or a new command -- dog.


From: David Kenneth Michael Weeks
Subject: rm and ln enhancements -- or a new command -- dog.
Date: Fri, 26 Oct 2001 14:36:56 -0400

To whom it may concern,

I'd like suggest an enhancement to the current commands of fileutils, or the 
addition of a new command (cat needs dog) that accomplishes the following:

I have precisely 1782 (ls -l | grep '^l' | wc -l , I moved the linked 
directory) dead link files in a directory with precisely 1072 (ls -l | grep 
'^-' | wc -l) original files, and I need to kill the dead links.

I've written a script that gets me close to this objective:

#! /bin/bash

# lsln -- list file name only of all files that are links.
# This script lists only files that are links, in either a specified
# directory, or your current directory.
# Copyright 2001, David Weeks, TampaPC.com, Tampa, Florida, USA.

if [ -d "$1" ]; then
        ls -l $1 | grep '^l' | cut -c 57-200 | 
        awk -F " -> " '{ print $1 }'
else
        ls -l | grep '^l' | cut -c 57-200 | 
        awk -F " -> " '{ print $1 }'
fi

# cool...

but when I either pipe this to rm (lsln | rm -f), or rm with command 
substitution (rm -f $(lsln)), or even try to feed it a list of a saved output 
(rm -f $(cat killthese)  or rm -f "$(cat killthese)), it breaks on file name 
abuses such as spaces and appostrophies.  I've even tried  ls -l | grep '^l' 
| cut -c 57-200 | awk -F " -> " | xargs rm   all to no solution.

So, it would be nice to have a command that wacks dead links.  I suggest the 
dog label cause I teach, and I like the fact that we have less and more.  Why 
not cat and dog?  For that matter, this is now OUR OS, let's start making 
commands named after animals.  It's the whole O'Reily, GNU, open source, 
penguin thing.  Hey, I want to call my up coming Linux configured PCs Orange, 
since I'm in Tampa and not the land of the Apple.

Anyway, I hope you can help me with this.  I'm still pretty narrow and 
shallow in my knowledge of OUR OS, and am working on it.

Thanks in advance.

David Weeks
Unix/Linux Instructor
and
Proprietor of TampaPC.com (off the air for now)

BTW:  my formal studies are in Law and Society, from the School of Public 
Affairs, The American University, Washington, DC.  I understand and 
appreciate and support what WE are about to the future of civil evolution.  
I've coined a new discipline:  Athronomics -- the study of human endeavors 
NOT based on the dollar (economics  Remember, that's the standing critizism 
of economics), but instead the value of character, abundance, and human based 
standards of weath and progress (not monetary).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]