Created
May 2, 2019 20:51
-
-
Save bayashi/a8ab164cd82535a004f2ab3d3ffa98b1 to your computer and use it in GitHub Desktop.
Invoke this from .bashrc for daily log
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my $SUBLIME = '/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'; | |
my $BASE_PATH = '/path/to/physical_file'; | |
my $SHORTCUT = '/path/to/Desktop/mylog.md'; | |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); | |
$year += 1900; | |
my $file = sprintf("%s/%s/%s%02d%02d.md", $BASE_PATH, $year, $year, ++$mon, $mday); | |
exit if -f $file; | |
open my $fh, '>', $file or die "Could not open $file $!"; | |
print $fh <<'_TXT_'; | |
# T | |
## S | |
* h | |
* f | |
_TXT_ | |
close $fh; | |
unlink $SHORTCUT if -f $SHORTCUT; | |
symlink $file, $SHORTCUT; | |
`$SUBLIME $SHORTCUT`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment