All pastes #297495 Raw Edit

Screwed script

public shellscript v1 · immutable
#297495 ·published 2006-12-31 03:34 UTC
rendered paste body
#!/bin/bashif [ $# -eq 0 ]; then exit 1; fifunction exists {    if [ -e "$1" ]; then	echo "WORD2TEXT - Error: '$txt' already exists."	return 0    else	return 1    fi}for arg; do    case $arg in	-) if [ -w "$PWD" ]	    then	    doc=".word2text.doc"	    #cat>"$doc"	    > "$doc"	    txt=""	    fi;;	*)  dir=`dirname "$arg"`	    if [ "$dir" == "" ]; then dir=$PWD; fi	    if [ -f "$arg" -a -w "$dir" ]	    then		doc=$arg		txt="${arg%doc}txt"	    fi;;    esac    while exists "$txt" || [ "$txt" == "" ]; do	echo "WORD2TEXT - please, rename your converted document: "	read txt    done    antiword -t "$doc" > "$txt" 2> /dev/null ||    (	echo "Error: The document you provided is not a Word document." > /dev/stderr	rm "$txt")done