Post

.bashrc More

Well here's one more, this one swaps the names of 2 files.

function swap()
{
    local TMPFILE=tmp.$$
    mv "$1" $TMPFILE
    mv "$2" "$1"
    mv $TMPFILE "$2"
}

The next one changes a filename to all lowercase characters.

function 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
}

And a function to find a file using part of its filename

function find_file() { find . -type f -iname '*'$*'*' -ls ; }

Oh and I added Prism for syntax highlighting!