Skip to content

Instantly share code, notes, and snippets.

@hara-y-u
Created December 14, 2009 01:14
Show Gist options
  • Save hara-y-u/255708 to your computer and use it in GitHub Desktop.
Save hara-y-u/255708 to your computer and use it in GitHub Desktop.
#!/bin/sh
#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
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment