<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-4790589811543157819</atom:id><lastBuildDate>Sat, 05 Oct 2024 02:10:07 +0000</lastBuildDate><category>shell script</category><category>News</category><title>Creative Codesmith</title><description>short. practical. usable. sexy. &#xa;&lt;br&gt;&#xa;development and design</description><link>http://creativecodesmith.blogspot.com/</link><managingEditor>noreply@blogger.com (Creative Codesmith)</managingEditor><generator>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4790589811543157819.post-5885433410448327534</guid><pubDate>Wed, 26 Jan 2011 14:32:00 +0000</pubDate><atom:updated>2011-01-28T23:47:30.510+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">shell script</category><title>Shell Script: Adding days to a date input - Part 2</title><description>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJz8kKI9Q8vbxiOcUQPDdqahPeb3_QO0bD9oeFdNG6W7adRBGwHR9zZ_1aYfBotS3xhr7JWKdVcpEzJRQXGuEb9nCJVlBvfi_wkmCXu39ofx6Q9NOUg2zouXKgdkuRyzrbYL8EtrWCSg/s1600/y10kbugfixed.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJz8kKI9Q8vbxiOcUQPDdqahPeb3_QO0bD9oeFdNG6W7adRBGwHR9zZ_1aYfBotS3xhr7JWKdVcpEzJRQXGuEb9nCJVlBvfi_wkmCXu39ofx6Q9NOUg2zouXKgdkuRyzrbYL8EtrWCSg/s320/y10kbugfixed.png&quot; width=&quot;276&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Apparently, there is still something wrong with the code in my&amp;nbsp;&lt;a href=&quot;http://creativecodesmith.blogspot.com/2011/01/shell-script-adding-days-to-date-input.html&quot;&gt;previous post&lt;/a&gt;.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Here a quick solution to the problem:&amp;nbsp;&lt;a href=&quot;http://www.williamrobertson.net/code/shift_date.txt&quot;&gt;shift_date.sh&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG6VyCvDsfPdYwTcuwnA_grshAEsVTR3u0QDUbbP2PjTZDC_82ZxnWK48GpkcE7YBHeHjA-aMIBXJYTn6wap1IZlFaPkT-AsZwOH1O5zHUJDRaA1qWXRxxo_wihUV9-ManmczZG3OSL-c/s1600/Selection_001.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;56&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG6VyCvDsfPdYwTcuwnA_grshAEsVTR3u0QDUbbP2PjTZDC_82ZxnWK48GpkcE7YBHeHjA-aMIBXJYTn6wap1IZlFaPkT-AsZwOH1O5zHUJDRaA1qWXRxxo_wihUV9-ManmczZG3OSL-c/s400/Selection_001.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSGrmTdfJBNwTfDoAqLV4A_Z-7Rz1TqUWDHpnqmtDxWOxUjjiACJhivDtO6BW4eizGOzSrSwoY_6u50lwYWvqdLfwHlG6wcafbds_DbJdfPI_DDuaCncOhbqqrtumzd9TepXbExmT7Iy0/s1600/Selection_002.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;68&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSGrmTdfJBNwTfDoAqLV4A_Z-7Rz1TqUWDHpnqmtDxWOxUjjiACJhivDtO6BW4eizGOzSrSwoY_6u50lwYWvqdLfwHlG6wcafbds_DbJdfPI_DDuaCncOhbqqrtumzd9TepXbExmT7Iy0/s400/Selection_002.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgraYdvVAG_sJKw6FFhvBA8BhlWqtI9-S_vP_k8gIduUctx1iVl7O_LCCl1b2-NWDhxLZSIRiy1sKsm8Gl64pZwKSmYqnzAXBWXgD_lItV1cvkhtrX5HuvGrxNYLG1eCt2xXnqfm4CzcrE/s1600/Selection_003.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;68&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgraYdvVAG_sJKw6FFhvBA8BhlWqtI9-S_vP_k8gIduUctx1iVl7O_LCCl1b2-NWDhxLZSIRiy1sKsm8Gl64pZwKSmYqnzAXBWXgD_lItV1cvkhtrX5HuvGrxNYLG1eCt2xXnqfm4CzcrE/s400/Selection_003.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;code&gt;#!/bin/ksh&lt;br /&gt;
&lt;br /&gt;
date_next=/home/micaela/date_next.txt&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt; #--- pretend this is your date input in YYYYMMDD format (string)&lt;/span&gt;&lt;br /&gt;
datestring=&#39;20101231&#39; &lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt; #--- convert string to date&lt;/span&gt;&lt;br /&gt;
datestamp=`date --date $datestring +%Y%m%d`&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt; #--- get the formatted date input (this time using shift_date.sh) and add one day to it&lt;/span&gt;&lt;br /&gt;
./shift_date.sh $datestamp 1 &amp;gt;&amp;gt; $date_next&lt;br /&gt;
dateplusone=`grep &#39;[0-9]&#39; $date_next`&lt;br /&gt;
&lt;br /&gt;
echo &quot;The date string is: &quot; $datestring&lt;br /&gt;
echo &quot;Date plus one is: &quot; $dateplusone&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt; #--- use it as a log file time stamp&lt;/span&gt;&lt;br /&gt;
logfile=daily_log_$dateplusone.txt&lt;br /&gt;
&lt;br /&gt;
echo -e &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000;&quot;&gt;&quot;Your log file is:&quot;&lt;/span&gt; $logfile&lt;br /&gt;
&lt;br /&gt;
touch $logfile&lt;br /&gt;
&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
Special thanks to Ate Nessel for pointing out the bug :D&lt;/div&gt;</description><link>http://creativecodesmith.blogspot.com/2011/01/shell-script-adding-days-to-date-input_26.html</link><author>noreply@blogger.com (Mickey)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJz8kKI9Q8vbxiOcUQPDdqahPeb3_QO0bD9oeFdNG6W7adRBGwHR9zZ_1aYfBotS3xhr7JWKdVcpEzJRQXGuEb9nCJVlBvfi_wkmCXu39ofx6Q9NOUg2zouXKgdkuRyzrbYL8EtrWCSg/s72-c/y10kbugfixed.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4790589811543157819.post-3084876317781945120</guid><pubDate>Sun, 23 Jan 2011 08:31:00 +0000</pubDate><atom:updated>2011-01-28T23:47:07.480+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">shell script</category><title>Shell Script: Adding days to a date input</title><description>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsO748T7yRbaG30Hm3poq9oJNyqg18AvhSaxQrD_J82vtMlXNWkWH8dPkWVaiSuAoT5sxXBYNgjjfasergOQ7vF30UAhdvNRXG0cJfeXLgO4orKcM9UOFs9f8AzRVz2N31oONJ2t3lUvE/s1600/programmer-job.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsO748T7yRbaG30Hm3poq9oJNyqg18AvhSaxQrD_J82vtMlXNWkWH8dPkWVaiSuAoT5sxXBYNgjjfasergOQ7vF30UAhdvNRXG0cJfeXLgO4orKcM9UOFs9f8AzRVz2N31oONJ2t3lUvE/s640/programmer-job.png&quot; width=&quot;249&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;(image taken from&amp;nbsp;&lt;a href=&quot;http://www.smashingapps.com/2010/12/18/what-its-like-to-be-a-programmer.html&quot;&gt;smashingapps.com&lt;/a&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
Last week, I spent approximately 2 hours trying to figure out how I could add 1 day to a shell script&#39;s date input.&lt;br /&gt;
And, this is the solution I came up with:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT1Z0Idu3MHkS-gDtKc1tTroWsvkXcDMe01MSNC0_k9boe6norTt4ZxnH62jlyPaojjlvnA4ZvXeBnWfZxW0v-q5WdNQXDlPKSKPjfchAYzafQv99pexFpb1x6yQ2-gR6U0ao8vH8lWrU/s1600/screenshot.2.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;62&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT1Z0Idu3MHkS-gDtKc1tTroWsvkXcDMe01MSNC0_k9boe6norTt4ZxnH62jlyPaojjlvnA4ZvXeBnWfZxW0v-q5WdNQXDlPKSKPjfchAYzafQv99pexFpb1x6yQ2-gR6U0ao8vH8lWrU/s400/screenshot.2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhORC0r2W-nKqcHKZzc06ZhMH5s_AGibnzMmSsjA5CEtLKCx97sOAv4tw2b7xpqm8t7NXNZ0Q_t7RyNTT31X2om_oGQlrulRug6vtEfQ6Bf7T_wkRpWCDjE6J9Inix1K4Omw81NQuaHdvY/s1600/screenshot.2.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;64&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhORC0r2W-nKqcHKZzc06ZhMH5s_AGibnzMmSsjA5CEtLKCx97sOAv4tw2b7xpqm8t7NXNZ0Q_t7RyNTT31X2om_oGQlrulRug6vtEfQ6Bf7T_wkRpWCDjE6J9Inix1K4Omw81NQuaHdvY/s400/screenshot.2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMMucK8Qi2lzago7Svp0gA-8ylPVazNFISLGnhmFN6mEg7Wfc4ioZfY9KQbfxLJC2Q4Dw0ggIi2MRIvCToB-aELlblBh8q-B3eAOkoJymXb8aN-la6NsK8RbmL4wDzzXCZzR4BH7HSsXw/s1600/screenshot.3.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;36&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMMucK8Qi2lzago7Svp0gA-8ylPVazNFISLGnhmFN6mEg7Wfc4ioZfY9KQbfxLJC2Q4Dw0ggIi2MRIvCToB-aELlblBh8q-B3eAOkoJymXb8aN-la6NsK8RbmL4wDzzXCZzR4BH7HSsXw/s400/screenshot.3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the code:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d; font-family: monospace;&quot;&gt;#--- pretend this is your date input in YYYYMMDD format (string)&lt;/span&gt;&lt;br /&gt;
&lt;code&gt; datestring=&#39;20110123&#39; &lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt; #--- convert string to date&lt;/span&gt;&lt;br /&gt;
datestamp=`date --date $datestring +%Y%m%d`&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt; #--- get the formatted date input and add one day to it&lt;/span&gt;&lt;br /&gt;
dateplusone=$((datestamp +1))&lt;br /&gt;
&lt;br /&gt;
echo &quot;The date string is: &quot; $datestring&lt;br /&gt;
echo &quot;Date plus one is: &quot; $dateplusone&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt; #--- use it as a log file time stamp&lt;/span&gt;&lt;br /&gt;
logfile=daily_log_$dateplusone.txt&lt;br /&gt;
&lt;br /&gt;
echo -e &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&quot;Finally after 2 hours you nailed it! Your log file is:&quot; &lt;/span&gt;$logfile&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt; &quot;\nTime to grab a cup of coffee and move on to the next task!&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
touch $logfile&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Hope this helps someone with the same problem :)</description><link>http://creativecodesmith.blogspot.com/2011/01/shell-script-adding-days-to-date-input.html</link><author>noreply@blogger.com (Mickey)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsO748T7yRbaG30Hm3poq9oJNyqg18AvhSaxQrD_J82vtMlXNWkWH8dPkWVaiSuAoT5sxXBYNgjjfasergOQ7vF30UAhdvNRXG0cJfeXLgO4orKcM9UOFs9f8AzRVz2N31oONJ2t3lUvE/s72-c/programmer-job.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4790589811543157819.post-9044158197935437697</guid><pubDate>Fri, 31 Dec 2010 16:00:00 +0000</pubDate><atom:updated>2011-01-01T03:03:09.223+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">News</category><title>Hello World!</title><description>&lt;div style=&quot;font-family: Verdana, sans; font-size: 1.15em; letter-spacing: 0.15em; line-height: 1.5em; margin: 30px 0 0 0; padding: 0; text-align: left;&quot;&gt;It&amp;#39;s the famous programmer&amp;#39;s test print code of all time.&lt;br&gt;
&lt;br&gt;
It stands true to its meaning...that and being the first post in this blog.&lt;br&gt;
&lt;br&gt;
And so at the brink of &lt;strong&gt;2011&lt;/strong&gt;...&lt;br&gt;
&lt;/div&gt;&lt;a href=&quot;http://creativecodesmith.blogspot.com/2011/01/hello-world.html#more&quot;&gt;Read more »&lt;/a&gt;</description><link>http://creativecodesmith.blogspot.com/2011/01/hello-world.html</link><author>noreply@blogger.com (Matt)</author><thr:total>0</thr:total></item></channel></rss>