Created
November 9, 2014 10:03
-
-
Save suzuki-kei/8d8f584a7bed9b9f036f to your computer and use it in GitHub Desktop.
memo と打つと ~/.memo/memo.YYYY-MM-DD.txt というファイルを作成し、$EDITOR で開いてくれる Bash スクリプトです。ファイルは daily でバックアップされます。
This file contains 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
function memo { | |
local memo_dir=~/.memo | |
mkdir -p "$memo_dir" | |
local current_memo_file=$memo_dir/memo.`date '+%Y-%m-%d'`.txt | |
local previous_memo_file=$memo_dir/`ls -1 "$memo_dir" | tail -1` | |
if [ ! -f "$current_memo_file" -a -f "$previous_memo_file" ]; then | |
cp -pi "$previous_memo_file" "$current_memo_file" | |
fi | |
$EDITOR $current_memo_file | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment