{"id":5608,"date":"2021-01-22T14:00:05","date_gmt":"2021-01-22T05:00:05","guid":{"rendered":"https:\/\/learningbox.co.jp\/?p=5608"},"modified":"2021-01-22T14:00:05","modified_gmt":"2021-01-22T05:00:05","slug":"blog_automate-daily-memo-creation-process","status":"publish","type":"post","link":"https:\/\/learningbox.co.jp\/en\/2021\/01\/22\/blog_automate-daily-memo-creation-process\/","title":{"rendered":"Automating the process of creating daily memo files with shell scripts"},"content":{"rendered":"<p>Hello. I'm Kamiyama, who joined the development department just recently.<br \/>\nI fire up my text editor to jot down things I've researched that day or things that have been on my mind, but the manual routine process has become tedious.<br \/>\nIn this article, I'd like to use a shell script to solve this problem.<\/p>\n<p class=\"mokujimidasi\">Click here for table of contents<\/p>\n<ul class=\"mokuji\">\n<li>1. What I want to do<\/li>\n<li>2. Create a shell script<\/li>\n<li>3. Execute the shell script<\/li>\n<li>4. Summary<\/li>\n<\/ul>\n<h2><b>What I want to do.<\/b><\/h2>\n<p>\u25bc Currently, the following tasks are being done manually.<\/p>\n<p class=\"well\">\n1. Open the directory where the memo is saved with VSCode.<br \/>\n2. Create a memo file for today in the format yyyy-MM-dd.md (e.g. 2021-01-20.md)<br \/>\n3. Copy and paste the template into the file you created.\n<\/p>\n<p>Hmm, this is troublesome. Let's automate tasks 1-3 with a shell script ASAP!<\/p>\n<h2><b>Create a shell script<\/b><\/h2>\n<p>This time, we'll work in the directory \/home\/kouyama\/memo-script.<br \/>\nLet's create a shell script named memo.sh.<br \/>\n<script src=\"https:\/\/gist.github.com\/emanon001\/c5b0f9eabf4dcecacf7719728594aefa.js?file=memo.sh\"><\/script><\/p>\n<p>If a file named template exists in the same directory as the shell script, it will be used to create a new memo file.<br \/>\nNow, let's also create a template file.<br \/>\n<script src=\"https:\/\/gist.github.com\/emanon001\/c5b0f9eabf4dcecacf7719728594aefa.js?file=template\"><\/script><\/p>\n<p>Preparation is complete. Now it's time to run the shell script!<\/p>\n<h2>Run a shell script<\/h2>\n<p>First, give the shell script execute permission.<\/p>\n<pre>$ chmod +x memo.sh<\/pre>\n<p>Next, pass through or alias the directory where the shell script resides.<br \/>\nThis time we will set an alias.<\/p>\n<pre>alias memo=\/home\/kouyama\/memo-script\/memo.sh<\/pre>\n<p>Now let's run it.<\/p>\n<pre>$ memo<\/pre>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5613 size-full\" src=\"https:\/\/tatsuno-system.co.jp\/wp-content\/uploads\/2021\/01\/memo_command_vscode.png\" alt=\"\" width=\"1024\" height=\"768\" srcset=\"https:\/\/learningbox.co.jp\/wp-content\/uploads\/2021\/01\/memo_command_vscode.png 1024w, https:\/\/learningbox.co.jp\/wp-content\/uploads\/2021\/01\/memo_command_vscode-300x225.png 300w, https:\/\/learningbox.co.jp\/wp-content\/uploads\/2021\/01\/memo_command_vscode-768x576.png 768w, https:\/\/learningbox.co.jp\/wp-content\/uploads\/2021\/01\/memo_command_vscode-16x12.png 16w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>VSCode is up and running, and it's opening a file with today's date!<\/p>\n<h2>summary<\/h2>\n<p>Small routine tasks of daily life were automated with shell scripts.<br \/>\nThere are a lot of routine tasks in our daily lives, so let's automate them to the extent it's worth the cost!<\/p>","protected":false},"excerpt":{"rendered":"\u3053\u3093\u306b\u3061\u306f\u3002\u3064\u3044\u6700\u8fd1\u958b\u767a\u90e8\u306b\u5165\u3063\u305f\u795e\u5c71\u3067\u3059\u3002 \u79c1\u306f\u305d\u306e\u65e5\u306b\u8abf\u3079\u305f\u4e8b\u3084\u6c17\u306b\u306a\u3063\u305f\u3053\u3068\u306a\u3069\u3092\u3001\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u3092\u8d77 [&hellip;]","protected":false},"author":38,"featured_media":5623,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"0","footnotes":""},"categories":[6,7,40],"tags":[59],"class_list":["post-5608","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-7","category-40","tag-59"],"acf":[],"jetpack_featured_media_url":"https:\/\/learningbox.co.jp\/wp-content\/uploads\/2021\/01\/2021-01-21_13-12-11.jpg","jetpack_shortlink":"https:\/\/wp.me\/pgMrZ4-1ss","_links":{"self":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/5608","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/users\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/comments?post=5608"}],"version-history":[{"count":21,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/5608\/revisions"}],"predecessor-version":[{"id":5636,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/5608\/revisions\/5636"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/media\/5623"}],"wp:attachment":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/media?parent=5608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/categories?post=5608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/tags?post=5608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}