<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CodeCondense]]></title><description><![CDATA[CodeCondense]]></description><link>https://blog.subratdwivedi.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1754761661900/bc4a543e-29f0-4e58-9f51-8bf201249876.png</url><title>CodeCondense</title><link>https://blog.subratdwivedi.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 11:32:01 GMT</lastBuildDate><atom:link href="https://blog.subratdwivedi.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Write Your First Bash Script (and Why You Absolutely Should)]]></title><description><![CDATA[Whether you're deep in the tech world or just watching from the sidelines, you might have come across the term “Bash Scripting”. And like many (including me!), you might’ve thought it’s some hacker-like stuff that a riced-out Arch Linux user plays wi...]]></description><link>https://blog.subratdwivedi.dev/how-to-write-your-first-bash-script-and-why-you-absolutely-should</link><guid isPermaLink="true">https://blog.subratdwivedi.dev/how-to-write-your-first-bash-script-and-why-you-absolutely-should</guid><category><![CDATA[Bash]]></category><category><![CDATA[shell script]]></category><category><![CDATA[command line]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Productivity]]></category><dc:creator><![CDATA[Subrat Dwivedi]]></dc:creator><pubDate>Sat, 30 Aug 2025 07:18:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1756537126453/6b933bbd-6160-47af-9f40-35565c6b5833.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Whether you're deep in the tech world or just watching from the sidelines, you might have come across the term “Bash Scripting”. And like many (including me!), you might’ve thought it’s some hacker-like stuff that a riced-out Arch Linux user plays with.</p>
<p>While not <em>entirely</em> wrong, Bash Scripting is an amazing tool that opens the door to creating powerful automations and configurations, all while gently easing you into the world of command-line interface (CLI).</p>
<h2 id="heading-so-what-is-bash-scripting">So, What is Bash Scripting?</h2>
<p>Simply put, Bash Scripting is writing a series of commands in a plain text file that the Bash shell can execute.</p>
<p>Think of it as automating the tasks that you’ll normally do on the command line. So instead of typing each command one by one, you write it all down in a script. Whenever you need that task done, just run the script and let it work for you!</p>
<p>These scripts can include:</p>
<ul>
<li><p>File operations (<code>mv</code>, <code>cp</code>, <code>rm</code>)</p>
</li>
<li><p>Loops and conditionals (<code>for</code>, <code>if</code>, <code>while</code>)</p>
</li>
<li><p>System commands (<code>top</code>, <code>df</code>, <code>ps</code>)</p>
</li>
<li><p>Even calling other programs or scripts</p>
</li>
</ul>
<p>Now mostly these scripts are native to UNIX-based systems like Linux and macOS but if you are a Windows user, you can still harness its power through Git Bash or WSL (Windows Subsystem for Linux).</p>
<h2 id="heading-why-learn-bash-scripting">Why learn Bash Scripting?</h2>
<p>Bash Scripting isn’t just some nerdy side-quest, it is also one of the most useful tools a developer can have. It saves time, reduces mistakes, and makes their workflows repeatable.</p>
<p>Here are a few examples of how different folks use it:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>🖥️Backend / DevOps</td><td>From pulling code to deploying apps and monitoring servers</td></tr>
</thead>
<tbody>
<tr>
<td>🛠️<strong>System Administrators</strong></td><td>User management, log rotation, and scheduling tasks for consistent functioning</td></tr>
<tr>
<td>🧪<strong>Data Scientists</strong></td><td>Scheduling cron jobs to scrape real-time data; Download, extract &amp; clean large datasets, chain python scripts for an end-to-end workflow and more</td></tr>
<tr>
<td>🌐<strong>Cloud Engineers</strong></td><td>Scripts to spin up servers, install software, configure networking and keep an eye on server health</td></tr>
</tbody>
</table>
</div><h2 id="heading-how-i-got-introduced-to-bash-scripting">How I got introduced to Bash Scripting</h2>
<p>Lately I’ve been working on a few React projects. If you have done that too, you can relate to how much of a chore setting up a new React project can be. I use Vite, so my workflow looks like this:</p>
<ol>
<li><p>Create a new project.</p>
</li>
<li><p>Select the React template.</p>
</li>
<li><p><code>cd</code> into the project directory.</p>
</li>
<li><p>Install node modules.</p>
</li>
<li><p>Initialize Git.</p>
</li>
<li><p>If I want to use Tailwind, I have to install Tailwind CSS.</p>
</li>
<li><p>Add it to the dependencies in Vite configuration.</p>
</li>
<li><p>Import Tailwind CSS in <code>index.css</code>.</p>
</li>
</ol>
<p>… and most of it is done using command line.</p>
<p>It got me thinking there must be a way to automate this, and that’s when I learnt about Bash Scripting.</p>
<p>What next? I ran to <a target="_blank" href="https://www.w3schools.com/bash/index.php">w3schools</a> and skimmed through the entire Bash Tutorial. Surprisingly, it felt just like any other programming language, with variables, loops, and conditionals working together with system commands.</p>
<p>The script I then created works something like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756525334793/5cef1dd8-b2cd-4a86-80f5-ba1f98f19038.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-writing-my-first-bash-script">Writing My First Bash Script</h2>
<p>After learning the fundamentals and practicing a few examples, I was ready to create my first real automation. I’ll share my process and the script so you can also benefit from it too! :)</p>
<ol>
<li><h3 id="heading-creating-a-script-file">Creating a Script File</h3>
<ul>
<li><p>First, create a new directory (e.g., <code>scripts</code>) as It’s ideal to keep all your scripts in a dedicated location.</p>
</li>
<li><p>Inside the directory, create a new shell script file (let’s call it <code>newreact.sh</code>). Inside, add this very important first line:</p>
<pre><code class="lang-bash">  <span class="hljs-comment">#!/bin/bash</span>
</code></pre>
<p>  This is called a <strong>shebang,</strong> and it tells the system to use Bash shell to execute this script.</p>
</li>
</ul>
</li>
</ol>
<ol start="2">
<li><h3 id="heading-commands-to-create-a-new-react-project">Commands to Create a new React Project</h3>
<pre><code class="lang-bash"> <span class="hljs-built_in">echo</span> <span class="hljs-string">"Initializing New React Project ..."</span>
 npm create vite@latest <span class="hljs-string">"<span class="hljs-variable">$1</span>"</span> -- --template react
 <span class="hljs-built_in">cd</span> <span class="hljs-variable">$1</span>
 npm install
</code></pre>
<ul>
<li><p><code>echo</code> displays text in the CLI so you know what’s going on.</p>
</li>
<li><p><code>$1</code> is a special variable that holds the first argument provided when running the script, which is the name of your new project.</p>
<p>  With that, your new project will be created with a single command! But we’re not done yet.</p>
</li>
</ul>
</li>
</ol>
<ol start="3">
<li><h3 id="heading-initializing-git-and-tailwind">Initializing Git and Tailwind</h3>
<p> For this, we will first check if the user wants to use Git and Tailwind CSS by looking for specific keywords in the arguments.</p>
<pre><code class="lang-bash"> <span class="hljs-keyword">for</span> arg <span class="hljs-keyword">in</span> <span class="hljs-string">"<span class="hljs-variable">$@</span>"</span>; <span class="hljs-keyword">do</span>
     <span class="hljs-keyword">if</span> [[ <span class="hljs-string">"<span class="hljs-variable">$arg</span>"</span> == <span class="hljs-string">"tw"</span> ]]; <span class="hljs-keyword">then</span>
         <span class="hljs-built_in">echo</span> <span class="hljs-string">"Installing TailwindCSS ..."</span>
         npm install tailwindcss @tailwindcss/vite

         <span class="hljs-built_in">echo</span> <span class="hljs-string">"Importing TailwindCSS ..."</span>
         sed -i <span class="hljs-string">'1i @import "tailwindcss";'</span> src/index.css
         <span class="hljs-comment"># for macOS =&gt; sed -i '' '1i @import "tailwindcss";' src/index.css</span>

         <span class="hljs-built_in">echo</span> <span class="hljs-string">"Configuring vite.config.js ..."</span>

         grep -q <span class="hljs-string">'tailwindcss'</span> vite.config.js || sed -i <span class="hljs-string">'1i import tailwindcss from "@tailwindcss/vite";'</span> vite.config.js
             <span class="hljs-comment"># for macOS =&gt; sed -i '' '1i import tailwindcss from "@tailwindcss/vite";' vite.config.js</span>

         sed -i <span class="hljs-string">'s/react()/react(), tailwindcss()/'</span> vite.config.js
     <span class="hljs-keyword">fi</span>

     <span class="hljs-keyword">if</span> [[ <span class="hljs-string">"<span class="hljs-variable">$arg</span>"</span> == <span class="hljs-string">"git"</span> ]]; <span class="hljs-keyword">then</span>
         <span class="hljs-built_in">echo</span> <span class="hljs-string">"Initializing Git ..."</span>
         git init
     <span class="hljs-keyword">fi</span>
 <span class="hljs-keyword">done</span>
</code></pre>
<ul>
<li><p><code>$@</code> gives you all arguments, which we can iterate over using a for loop and match using <code>if</code> conditions.</p>
</li>
<li><p>Notice how the condition starts with <code>if</code> and ends with <code>fi</code>, which is the reverse of <code>if</code>? It’s one of the quirky syntax bits of Bash scripting language that you will not forget easily.</p>
</li>
<li><p><code>sed</code> is a powerful command used to process and manipulate text. We use it here to add statements in <code>index.css</code> and <code>vite.config.js</code> files in order to properly import and initialize Tailwind CSS in our project.</p>
</li>
</ul>
</li>
</ol>
    <details><summary>Important Note</summary><div data-type="detailsContent">Be very careful of where you use whitespaces. It can make or break your code. However, indentations before the statements don’t have any special meaning unlike Python. They are used for code readability.</div></details>

<ol start="4">
<li><h3 id="heading-finishing-up">Finishing up</h3>
<p> Our script is almost done. Now to make our lives easier, we can open up VS Code right after setting up the project.</p>
<p> Just add <code>code .</code> at the end of the script to open it up in the project directory you just created.</p>
<pre><code class="lang-bash"> <span class="hljs-built_in">echo</span> <span class="hljs-string">"Setup Complete! Opening VS Code ..."</span>
 code .
 <span class="hljs-comment"># This assumes you have the code command installed in your system's PATH, which is standard with a VS Code installation.</span>
</code></pre>
<p> AND we’re done! ✨</p>
</li>
<li><h3 id="heading-making-this-script-executable">Making this script Executable</h3>
<p> We have written the script, but it can’t be executed just yet as the system still sees it as a regular text file. Let’s make it executable.</p>
<p> Navigate to the <code>scripts</code> directory in the terminal where you created your script and run this command:</p>
<pre><code class="lang-bash"> chmod +x newreact.sh
</code></pre>
<ul>
<li><p><code>chmod</code> stands for “change mode”.</p>
</li>
<li><p><code>+x</code> gives “execute” permission.</p>
</li>
</ul>
</li>
</ol>
<ol start="6">
<li><h3 id="heading-add-the-directory-to-your-path">Add the Directory to Your PATH</h3>
<p> Our script works now, but typing the entire path, like <code>~/scripts/newreact.sh</code> is tedious. Simply typing its name should launch it from any directory.</p>
<ul>
<li><p>To accomplish that we will add our <code>scripts</code> directory to <strong>PATH</strong> so the system looks for our script in the directory by itself. To do that, run the following command:</p>
<p>  For Bash users:</p>
<pre><code class="lang-bash">  <span class="hljs-built_in">echo</span> <span class="hljs-string">'export PATH="$PATH:$HOME/scripts"'</span> &gt;&gt; ~/.bashrc
</code></pre>
<p>  For Zsh users (macOS):</p>
<pre><code class="lang-bash">  <span class="hljs-built_in">echo</span> <span class="hljs-string">'export PATH="$PATH:$HOME/scripts"'</span> &gt;&gt; ~/.zshrc
</code></pre>
</li>
<li><p>To apply the changes, either close and reopen the terminal OR run the following command:</p>
<pre><code class="lang-bash">  <span class="hljs-built_in">source</span> ~/.bashrc  <span class="hljs-comment"># for Bash</span>
  <span class="hljs-built_in">source</span> ~/.zshrc   <span class="hljs-comment"># for Zsh</span>
</code></pre>
</li>
</ul>
</li>
</ol>
<details><summary>What is PATH?</summary><div data-type="detailsContent">The PATH is a list of all the folders the shell looks at when you run a command; think of it as your terminal's address book.</div></details>

<ol start="7">
<li><h3 id="heading-try-it-out">Try It Out</h3>
<p> Navigate to your desired projects directory, and run this command to create a new project:</p>
<pre><code class="lang-bash"> newreact.sh my-cool-project git tw
</code></pre>
</li>
</ol>
<h2 id="heading-well-what-next">Well… What Next?</h2>
<p>By now you have learnt about the usage and importance of Bash scripting and even created your own first script. But trust me, it's not the last. You can find an idea or another of a repetitive task that's just <em>begging</em> to be automated.</p>
<p>Seriously, once you start seeing the world through a "scripting lens", you'll see opportunities everywhere.</p>
<ul>
<li><p>That boring chore of organizing your Downloads folder? <strong>Script it.</strong></p>
</li>
<li><p>Want to back up your important project files to another drive with one command? <strong>Script it.</strong></p>
</li>
<li><p>Need to update all your system packages and clean up old files? <strong>You guessed it—script it.</strong></p>
</li>
</ul>
<p>Heck, take the script we just built and go wild. Add an option for TypeScript, or maybe one to automatically open the browser. It's your tool now, so make it work for you.</p>
<p>The point isn't to become some elite hacker overnight. It's about making your own life a tiny bit easier, one script at a time.</p>
<p>P.S. Just for fun, comment down below how many times I used the word "script" or "scripting." Even I feel like I went a little overboard! 😆</p>
]]></content:encoded></item><item><title><![CDATA[The First Steps: Setting Up My Developer Portfolio]]></title><description><![CDATA[Every developer needs a portfolio. It's our digital handshake. But getting from a folder of code on your computer to a live website on a professional domain can feel overwhelming. I was in that exact spot just a few days ago.
Here's my complete proce...]]></description><link>https://blog.subratdwivedi.dev/the-first-steps-setting-up-my-developer-portfolio</link><guid isPermaLink="true">https://blog.subratdwivedi.dev/the-first-steps-setting-up-my-developer-portfolio</guid><category><![CDATA[React]]></category><category><![CDATA[portfolio]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Subrat Dwivedi]]></dc:creator><pubDate>Sat, 09 Aug 2025 07:07:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1754722301539/75e43b09-9598-4ee0-9831-4a7356f2b0ca.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Every developer needs a portfolio. It's our digital handshake. But getting from a folder of code on your computer to a <strong>live website on a professional domain</strong> can feel overwhelming. I was in that exact spot just a few days ago.</p>
<p>Here's my complete process, from development all the way to deployment. Let's get it done. 🚀</p>
<h2 id="heading-step-1-build-a-portfolio-duh">Step 1: Build a Portfolio (duh!)</h2>
<p>Obviously, the first step to having a portfolio website is... building it. For me, this started with the design. I wanted a <em>clean, intuitive look with a bit of creative elements</em> that would put my projects front and center without too many distractions.</p>
<p>This is where many people (including me) can get stuck in a loop. I drafted so many different layouts and versions that I’m pretty sure even Figma was like- “Just build something already!”</p>
<p>Once I finally settled on a design, it was time for the development stage. I decided to build the site with <strong>React</strong> and <strong>Tailwind CSS</strong>. The main reason was simple: they were the technologies I was actively learning, and I believe the best way to solidify a new skill is to build something meaningful with it.</p>
<p>It turned out to be the perfect choice. Using <strong>React</strong> let me break down my portfolio into reusable components (like the header, project cards, and footer), which made the code much easier to manage. And <strong>Tailwind CSS</strong> was a lifesaver for someone like me who loves to constantly tweak the design. The utility-first approach meant I could make tiny visual changes quickly without ever leaving my HTML.</p>
<p>I mean look at this div element, what atrocities it must have endured…</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754680351831/ca299501-e7e9-4327-9f61-fad6bfefe53b.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-step-2-hosting-the-portfolio-on-vercel">Step 2: Hosting the Portfolio on Vercel</h2>
<p>Wouldn’t life be easier if we could just build awesome projects on our PC and have the world experience them right away? Well, back to reality.</p>
<p>My portfolio was developed, and now it was time to deploy it. There are many free and easy-to-use platforms out there, but I went with <a target="_blank" href="http://vercel.com">Vercel</a> because it’s one of the most popular and dependable ones.</p>
<p>For hosting, you can either use the <strong>Vercel CLI</strong> or connect it directly to a <strong>GitHub repository</strong>. I recommend the latter; it’s incredibly simple to set up. All I had to do was create a GitHub repo for my portfolio, log in to Vercel, and import it. Vercel handles the rest, including automatic updates.</p>
<p>Now, Vercel fetches the code directly from GitHub. I just have to worry about making changes when a new idea for a design tweak hits me at 1 AM, and then <code>git push</code>. <em>It feels like magic</em>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754681645067/ccb56c3c-15ab-4cd1-9679-0f7fd9bf7780.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-step-3-something-feels-missing-a-personal-domain">Step 3: Something Feels Missing- A Personal Domain</h2>
<p>At this point, my portfolio was deployed for the world to see. I took a deep breath of contentment... and then I looked at the URL. Seeing my portfolio live at a domain ending in <code>.vercel.app</code>, I realized the goal was still unachieved.</p>
<p>The first thought hit me: “<em>I have to get a personal domain.</em>” This was instantly followed by a second thought: “But that costs money!”</p>
<p>Luckily, as a student, I could get a free domain name for one year through the <a target="_blank" href="https://github.com/education"><strong>GitHub Student Developer Pack (GSDP)</strong></a>. I explored the offers from registrars like <a target="_blank" href="https://www.name.com/">Name.com</a> and <a target="_blank" href="https://www.namecheap.com/">Namecheap</a>, signed up via the GSDP, and bought my very first domain. Oh, I couldn’t have been happier.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754680609605/4fc74e2f-c85e-4bc7-aa43-79159324a161.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-step-4-connecting-the-dots">Step 4: Connecting the Dots</h2>
<p>I was so excited to have my new domain, <a target="_blank" href="https://www.subratdwivedi.dev/"><code>subratdwivedi.dev</code></a>, but it was just a name. It wasn't connected to the portfolio I had hosted on Vercel yet. I braced myself, thinking this part would be complicated, but it turned out to be surprisingly straightforward.</p>
<p>First, I went over to my Vercel project <code>Dashboard &gt; Settings &gt; Domains</code>, and typed in my new domain name. Vercel then gave me the exact "directions" I needed—an <code>A Record</code> (an IP address) and a <code>CNAME Record</code> (for the www version).</p>
<p>Grabbing these values, I logged back into my <a target="_blank" href="https://www.name.com/">Name.com</a> account and went to the <code>Manage DNS Records</code> page. Then all I had to do was create new records at Name.com and paste in the values from Vercel.</p>
<p>After saving the changes, there's a short waiting period called "DNS propagation" (basically, waiting for the internet's address book to update). I nervously refreshed the page for a few minutes, and then I decided to just try it.</p>
<p>I opened a new tab, typed in <a target="_blank" href="https://www.subratdwivedi.dev/"><code>subratdwivedi.dev</code></a>, hit Enter... and there it was. My own portfolio, live on my own domain. That feeling was incredible.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754720644505/a883af58-a5bb-4e88-99aa-8ee59c259f1d.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>And there you have it! From a simple folder of code on my computer to a polished portfolio live on a professional <code>.dev</code> domain.</p>
<p>My biggest takeaway from this process is that building your online home isn't as daunting as it seems. With amazing free tools like Vercel and the GitHub Student Developer Pack, the barrier to entry is lower than ever. All it takes is a little curiosity and the willingness to connect the dots.</p>
<p>Of course, a portfolio is just one half of the story. In my next post, I'll cover <strong>Part 2</strong>: how I set up this very blog using Hashnode and connected it to a subdomain. Stay tuned!</p>
<p>I hope my experience can act as a guide and encouragement for you. If you have any questions, drop them in the comments below!</p>
]]></content:encoded></item></channel></rss>