more from the cave

From: <captgoodnight@acsalaska.net>
Date: Sat Mar 13 2004 - 18:59:54 AKST

Hello fellow penguins,
I'm 95% happy with the results of my latest creation, for those that have the
first, umm, cough, version (hehe) I thought it would be appropriate to hand
out what I have come up with as the, umm, cough, second version (hehe). Maybe
the ideas in this script can help in some way. This one has many code
corrections and different processing methods. I've learned tons from this.
Next might be to shorten it up, glimpses into this is becoming more common.
 
Oh, I gotta also share these things from my .bashrc file too, really usefull
for me. I obviously didn't create the really tweaked and complicated ones ;)

bests all,
eddie
 
ICQ# 294477332

-- Binary/unsupported file stripped by Ecartis --
-- Type: application/x-shellscript
-- File: wma2mp3

-- Attached file included as plaintext by Ecartis --
-- File: bashrc_ideas

hog() #whos hogging the hdd, usage:hog directory user
{
find $1 -type d -xdev -user $2 | sed -e 's/ /\\ /g' -e "s/[']/\\\'/g" | xargs du -sm | sort -g
}

#whats playing on xmms, needs xmms plugin called xmms-infopipe
function playing()
{
if [ -p /tmp/xmms-info_captgoodnight.0 ]
then
echo -e $red ;cat /tmp/xmms-info | sed -e '1,2d' -e '4,6d' -e '8d' -e '10,12d' ; echo -e $NC
fi
}

# Define some colors first:
red='\e[0;31m'
RED='\e[1;31m'
blue='\e[0;34m'
BLUE='\e[1;34m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
NC='\e[0m' # No Color

function space() #good for mandrake 9.2
{
echo -e $red; df -hP | sed -e '1s/Filesystem/ Filesystem/'; \ echo -e $NC
}

function read_all()
{
for i in *
do
less $i && read $a
done
}

function fe() { find . -name '*'$1'*' -exec $2 {} \; ; } # find a file and #run $2 on it

function fstr() # find a string in a set of files
{
    if [ "$#" -gt 2 ]; then
        echo "Usage: fstr \"pattern\" [files] "
        return;
    fi
    SMSO=$(tput smso)
    RMSO=$(tput rmso)
    find . -type f -name "${2:-*}" -print | xargs grep -sin "$1" | sed "s/$1/$SMSO$1$RMSO/gI"
}

function lowercase() # move filenames to lowercase
{
    for file ; do
        filename=${file##*/}
        case "$filename" in
        */*) dirname==${file%/*} ;;
        *) dirname=.;;
        esac
        nf=$(echo $filename | tr A-Z a-z)
        newname="${dirname}/${nf}"
        if [ "$nf" != "$filename" ]; then
            mv "$file" "$newname"
            echo "lowercase: $file --> $newname"
        else
            echo "lowercase: $file not changed."
        fi
    done
}

function swap() # swap 2 filenames around
{
    local TMPFILE=tmp.$$
    mv $1 $TMPFILE
    mv $2 $1
    mv $TMPFILE $2
}

function repeat() # repeat n times command
{
    local i max
    max=$1; shift;
    for ((i=1; i <= max ; i++)); do # --> C-like syntax
        eval "$@";
    done
}

function ask()
{
    echo -n "$@" '[y/n] ' ; read ans
    case "$ans" in
        y*|Y*) return 0 ;;
        *) return 1 ;;
    esac
}

calc(){ perl -wlne'print eval'; }
     export -f calc

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sat Mar 13 19:00:03 2004

This archive was generated by hypermail 2.1.8 : Sat Mar 13 2004 - 19:00:03 AKST