Created
December 14, 2009 01:14
-
-
Save hara-y-u/255708 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment