Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Just cleared a huge item from my TODO

Name: Anonymous 2009-06-18 13:51

export ZLE_SPACE_SUFFIX_CHARS=$'&|'

Name: Anonymous 2009-06-18 16:57

todo() {
        if [ -z "$EDITOR" ]; then
                echo 'Script only works if you have EDITOR set.'
                return 1
        fi

        local tdir twhat tfile tcmd topts
        tdir="$HOME/.TODO"
        if [ ! -d $tdir ]; then
                echo "Installing todo..."
                mkdir $tdir
                if [ "$?" -ne 0 ]; then
                        echo "Failed installing."
                        exit 1
                fi
                echo "Made directory $tdir"
        fi
        case "$1"; in
                "-h")
                        echo -e "Use: $0 [ed|rm|cat|ls] [<what>]\n First option defaults to cat,\n"\
                                " second to default"
                        return 0
                ;;
                ed)
                        tcmd=$EDITOR
                        shift
                ;;
                rm)
                        tcmd=rm
                        topts="-i"
                        shift
                ;;
                cat)
                        tcmd=cat
                        shift
                ;;
                ls)
                        ls $tdir
                        return 0
                ;;
                *)
                        tcmd=cat
                ;;
        esac
        if [ "a$1" = "a" ]; then
                twhat=default
        else
                twhat="$1"
        fi
        tfile="$tdir/$twhat"
        if [ ! -f $tfile ]; then
                touch $tfile
        fi
        if [ "$tcmd" = "cat" ] && [ "`wc -l <$tfile`" -gt "24" ]; then
                tcmd=less
        fi
        $tcmd $topts $tfile
        return 0
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List