<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>bash &amp;mdash; sandeepk</title>
    <link>https://blogs.dgplug.org/sandeepk/tag:bash</link>
    <description></description>
    <pubDate>Thu, 30 Apr 2026 13:30:38 +0000</pubDate>
    <item>
      <title>Script that opens all Applications, that you needed for the work.</title>
      <link>https://blogs.dgplug.org/sandeepk/script-that-opens-all-applications-that-you-needed-for-the-work</link>
      <description>&lt;![CDATA[I have written this script a few months back, that runs the application that I  use daily for work, If I login into the system at a specific time interval :)&#xA;&#xA;In this logic we check what is the day of the week is, If it is Saturday or Sunday exit the script. The command used here is &#xA;cut - remove sections from each line of files&#xA;d - use DELIM instead of TAB for the field delimiter&#xA;f select only these fields;  also print any line that  contains  no delimiter  character,  unless the -s option is specified* &#xA;&#xA;day=$(date | cut -d &#34; &#34; -f1)&#xA;notdays=(Sun Sat)&#xA;if [[ &#34; ${notdays[@]} &#34; =~ $day ]]&#xA;then&#xA;    exit 1&#xA;fi&#xA;&#xA;Here we&#39;re calculating the difference with the current time on the system, If the difference is less than one, we will specify the application we want to run, else exit.&#xA;dbtimestamp=1050&#xA;secondsDiff=$(( date &#39;+%H%M&#39; - $dbtimestamp ))&#xA;echo $secondsDiff&#xA;&#xA;So here is the full script&#xA;!/bin/bash                                                               &#xA;&#xA;day=$(date | cut -d &#34; &#34; -f1)&#xA;notdays=(Sun Sat)&#xA;if [[ &#34; ${notdays[@]} &#34; =~ $day ]]&#xA;then&#xA;    exit 1&#xA;fi&#xA;&#xA;dbtimestamp=1050&#xA;secondsDiff=$(( date &#39;+%H%M&#39; - $dbtimestamp ))&#xA;&#xA;if [ $secondsDiff -lt 1 ]&#xA;then&#xA;  hexchat &amp;&#xA;  firefox &amp;&#xA;  safeeyes &amp;&#xA; # other application you want to open&#xA;else&#xA;  exit 0&#xA;fi ;&#xA;There are some improvements which I will do in the scripts in future&#xA;Time delta logic for running the application needs to be improved.&#xA;Flag to override the all check condition and run the applications&#xA;&#xA;Cheers!&#xA;&#xA;#100DaysToOffload #Automation #Bash&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>I have written this script a few months back, that runs the application that I  use daily for work, If I login into the system at a specific time interval :)</p>

<p>In this logic we check what is the day of the week is, If it is <em>Saturday or Sunday</em> exit the script. The command used here is
– cut – remove sections from each line of files
– d – use DELIM instead of TAB for the field delimiter
– f select only these fields;  also print any line that  contains  no delimiter  character,  unless the -s option is specified*</p>

<pre><code class="language-bash">day=$(date | cut -d &#34; &#34; -f1)
not_days=(Sun Sat)
if [[ &#34; ${not_days[@]} &#34; =~ $day ]]
then
    exit 1
fi
</code></pre>

<p>Here we&#39;re calculating the difference with the current time on the system, If the difference is less than one, we will specify the application we want to run, else exit.</p>

<pre><code class="language-bash">dbtimestamp=1050
secondsDiff=$(( `date &#39;+%H%M&#39;` - $dbtimestamp ))
echo $secondsDiff
</code></pre>

<p>So here is the full script</p>

<pre><code class="language-bash">#!/bin/bash                                                               

day=$(date | cut -d &#34; &#34; -f1)
not_days=(Sun Sat)
if [[ &#34; ${not_days[@]} &#34; =~ $day ]]
then
    exit 1
fi

dbtimestamp=1050
secondsDiff=$(( `date &#39;+%H%M&#39;` - $dbtimestamp ))

if [ $secondsDiff -lt 1 ]
then
  hexchat &amp;
  firefox &amp;
  safeeyes &amp;
 # other application you want to open
else
  exit 0
fi ;
</code></pre>

<p>There are some improvements which I will do in the scripts in future
– Time delta logic for running the application needs to be improved.
– Flag to override the all check condition and run the applications</p>

<p>Cheers!</p>

<p><a href="/sandeepk/tag:100DaysToOffload" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">100DaysToOffload</span></a> <a href="/sandeepk/tag:Automation" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Automation</span></a> <a href="/sandeepk/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a></p>
]]></content:encoded>
      <guid>https://blogs.dgplug.org/sandeepk/script-that-opens-all-applications-that-you-needed-for-the-work</guid>
      <pubDate>Sat, 10 Apr 2021 16:12:56 +0000</pubDate>
    </item>
  </channel>
</rss>