Skip to content

Instantly share code, notes, and snippets.

@hara-y-u
Created December 14, 2009 01:14

Revisions

  1. hara-y-u revised this gist Dec 14, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hoard.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/sh
    #Local twitter on the shell
    #hoard.sh: Private twitter on the shell
    #usage:
    # hoard "some string here": for store your hoard into file
    # hoard -s: hoard: for See your recent hoard
  2. hara-y-u revised this gist Dec 14, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hoard.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #/bin/sh
    #!/bin/sh
    #Local twitter on the shell
    #usage:
    # hoard "some string here": for store your hoard into file
  3. hara-y-u revised this gist Dec 14, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hoard.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    #Local twitter on the shell
    #usage:
    # hoard "some string here": for store your hoard into file
    # hoard -s: for See your recent hoard
    # hoard -s: hoard: for See your recent hoard
    # hoard -e: for Edit your recent hoard

    #Change these lines for your System.
  4. hara-y-u created this gist Dec 14, 2009.
    41 changes: 41 additions & 0 deletions hoard.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #/bin/sh
    #Local twitter on the shell
    #usage:
    # hoard "some string here": for store your hoard into file
    # hoard -s: for See your recent hoard
    # hoard -e: for Edit your recent hoard

    #Change these lines for your System.
    hoarddir="/Users/$USER/Documents/Hoard/"
    hoardfile="`date +%Y%m`.txt"
    myPager="lv"
    myEditor="vi"

    while getopts "se" opt
    do
    case $opt in
    s )
    $myPager "$hoarddir$hoardfile"
    exit 0
    ;;
    e )
    $myEditor "$hoarddir$hoardfile"
    exit 0
    ;;
    esac
    done

    # Store string in hoardstr
    hoardstr=$*
    if [ -z "$hoardstr" ]; then
    $myPager "$hoarddir$hoardfile"
    exit 0
    fi

    pushd "$hoarddir"
    hoardstr="$hoardstr [`date +%D-%H:%M`]"
    echo "$hoardstr" >> "$hoardfile"
    popd

    exit 0