<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Babs</title>
    <description>The latest articles on DEV Community by Babs (@babsarena).</description>
    <link>https://dev.to/babsarena</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1037906%2F7ffe2d56-2195-45a7-bceb-0791f4c57bcf.jpg</url>
      <title>DEV Community: Babs</title>
      <link>https://dev.to/babsarena</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/babsarena"/>
    <language>en</language>
    <item>
      <title>Learn Bash Scripting With Me 🚀 - Day 8</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Wed, 01 Oct 2025 12:42:47 +0000</pubDate>
      <link>https://dev.to/babsarena/learn-bash-scripting-with-me-day-8-k6b</link>
      <guid>https://dev.to/babsarena/learn-bash-scripting-with-me-day-8-k6b</guid>
      <description>&lt;h2&gt;
  
  
  Day 8 - Positional Parameters
&lt;/h2&gt;

&lt;p&gt;In case you’d like to revisit or catch up on what we covered on Day Seven, here’s the link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://dev.to/babsarena/learn-bash-scripting-with-me-day-7-40nc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Positional parameters in Bash scripting are special variables that hold the arguments passed to a script, a function, or a command. They are numerically named: $1, $2, $3, and so on, up to $9. For arguments beyond the ninth, you must use braces, like ${10}, ${11}, etc.&lt;/p&gt;

&lt;p&gt;NB- The first argument $0 is owned by the script itself which is when you run the script e.g ./script.sh&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You might be confused but it will make more sense as we move on.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SCRIPT
&lt;/h2&gt;

&lt;p&gt;For this lab we want to create a script that will automatically create a user for us.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzyw4wbjprboazgd4kq1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzyw4wbjprboazgd4kq1.png" alt=" " width="800" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

echo "Execution of script: $0"
echo "Please enter the name of the new user: $1"

# Adding user command
adduser --home /$1 $1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔍 Line-by-Line Breakdown&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A. Shebang:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Tells the system to execute this script with the Bash shell.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;B. Script Name Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Execution of script: $0"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;$0 is a positional parameter that contains the script’s filename, If you run ./user.sh bob, $0 will be ./user.sh.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;C. User Input (via Positional Parameter)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Please enter the name of the new user: $1"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;$1 is the first argument passed to the script, e.g "./user.sh bob" $1 will be bob.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;D. Adding the User&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adduser --home /$1 $1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Runs the adduser command to create a new user.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;--home /$1 → sets the home directory to /$1.&lt;/p&gt;

&lt;p&gt;Example: if $1 = bob, home directory becomes /bob.&lt;/p&gt;

&lt;p&gt;$1 → the username.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HOW TO RUN THE SCRIPT&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My script is created and saved as &lt;strong&gt;user.sh&lt;/strong&gt;
So if I want to create the user &lt;strong&gt;babs&lt;/strong&gt;, I would run the script with root privilege with the command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./user.sh babs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output of the script&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyq9gp2kmwxdf9q8zzbhf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyq9gp2kmwxdf9q8zzbhf.png" alt=" " width="800" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The user babs has been successfully created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚀 Key Takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;$0 → script name&lt;/p&gt;

&lt;p&gt;$1 → first argument (the new username)&lt;/p&gt;

&lt;p&gt;If you would like to learn more about Bash scripting you can checkout the  bash scripting room on TRYHACKME. Link attached below ⬇️&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://tryhackme.com/room/bashscripting
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>bash</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>linux</category>
    </item>
    <item>
      <title>Learn Bash Scripting With Me 🚀 - Day 7</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Thu, 25 Sep 2025 22:20:20 +0000</pubDate>
      <link>https://dev.to/babsarena/learn-bash-scripting-with-me-day-7-40nc</link>
      <guid>https://dev.to/babsarena/learn-bash-scripting-with-me-day-7-40nc</guid>
      <description>&lt;h2&gt;
  
  
  Day 7 - Functions
&lt;/h2&gt;

&lt;p&gt;In case you’d like to revisit or catch up on what we covered on Day Six, here’s the link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://dev.to/babsarena/learn-bash-scripting-with-me-day-6-1i1n
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;function&lt;/strong&gt; in Bash is a named block of code that you can define once and then call (reuse) multiple times in your script or shell session.&lt;/p&gt;

&lt;p&gt;It’s like a mini-script inside your script.&lt;/p&gt;

&lt;h2&gt;
  
  
  How To Declare A Function
&lt;/h2&gt;

&lt;p&gt;NB- a function must be declared before it is called upon to execute. (note this cause I am about to confuse you later)&lt;/p&gt;

&lt;p&gt;There are two ways to declare a function:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Style 1:&lt;/strong&gt; with function, no parentheses needed (but you can add it if you want)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function function_name {
echo "Hello from function"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔎 Breakdown&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;function&lt;/strong&gt; - This keyword tells Bash: "Hey, I’m about to define a function."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;function_name - This is the name of the function. You can call it later just by typing: &lt;strong&gt;function_name&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;{ ... }&lt;/strong&gt; The curly braces wrap the block of commands that belong to the function. Everything inside will run when you call function_name.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important detail:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The opening brace { must be on the same line as the function name (or else Bash might get confused).&lt;/p&gt;

&lt;p&gt;You need a space before {.&lt;/p&gt;

&lt;p&gt;The closing brace } should be on its own line (or at least separated properly).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;echo "Hello from function" - This is the body of the function — the actual command(s) that will run when you call it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Style 2:&lt;/strong&gt; without &lt;code&gt;function&lt;/code&gt;, parentheses are required&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_bash() {
echo "Hello from function"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NB- parenthesis () is a must&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔎 Breakdown&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;my_bash()&lt;/strong&gt; This is the function name followed by empty parentheses. The () tells Bash: "This is a function definition, not a normal command or variable." Unlike the function keyword style, here the parentheses are required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;{ ... }&lt;/strong&gt; Curly braces wrap the body of the function. Everything inside will run when the function is called.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Formatting rules:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;There must be a space between () and {.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each command inside should be on its own line (or separated by ;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The closing } should be on its own line.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;echo "Hello from function"&lt;/strong&gt; This is the command inside the function body.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sample Using Style 1
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffaamvfmnv911cmfxr0bb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffaamvfmnv911cmfxr0bb.png" alt=" " width="800" height="261"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash 

# The goal of this script is to test if the /etc/shadow file that stores password hash exists

function test_shadow {
    echo "---checking for shadow file---"
    if [ -e /etc/shadow ]; then
        echo "shadow file exists"
    fi
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔎 Breakdown
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The shebang line: Tells the system to run this script using the Bash interpreter located at /bin/bash.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# The goal of this script is to test if the /etc/shadow file that stores password hash exists
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The # is used for comment or documentation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
function test_shadow { ... }&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Declares a function named test_shadow. Everything between { ... } will be executed when you call test_shadow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
echo "---checking for shadow file---"&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Inside the function: Prints a message to show the script is about to test for the file.&lt;br&gt;
&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
if [ -e /etc/shadow ]; then&lt;br&gt;
echo "shadow file exists"&lt;br&gt;
fi&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;if&lt;/strong&gt; starts a conditional statement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;[ -e /etc/shadow ] checks if the file /etc/shadow exists.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;-e&lt;/strong&gt; means “file exists (any type)”.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;;&lt;/strong&gt; then separates the condition from the commands that should run if it’s true.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;echo "shadow file exists" runs only if the condition is true.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;fi&lt;/strong&gt; ends the if block (fi is literally if spelled backwards).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Calling the function&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To execute it, you need to add this at the bottom:&lt;br&gt;
&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
test_shadow&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output Of The Script&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw8chjix78z9amvzv6jwd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw8chjix78z9amvzv6jwd.png" alt=" " width="464" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above image shows the output of the script&lt;/p&gt;

&lt;p&gt;NB- Remember I mentioned "a function must be declared before it is called upon to execute. (note this cause I am about to confuse you later)"&lt;/p&gt;

&lt;p&gt;This is actually not the case when running a function inside a function.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running A Function Inside A Function
&lt;/h2&gt;

&lt;p&gt;When you run a Bash script, the shell does two main steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Parsing (reading and analyzing)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bash reads the whole script text first.&lt;/p&gt;

&lt;p&gt;It breaks the text into commands, keywords, and function definitions.&lt;/p&gt;

&lt;p&gt;At this stage, it doesn’t execute the commands — it just understands the structure.&lt;/p&gt;

&lt;p&gt;That’s how Bash already knows that there are functions, even before they are called.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Execution (actually running commands)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After parsing, Bash starts executing line by line in order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sample Script&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgoe7uq6kptuyw6oxrixq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgoe7uq6kptuyw6oxrixq.png" alt=" " width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the above is a script I created, run it, share your output and see if you can explain the script or make sense of it on your own.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The output of the script&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhqys3e97gbxflrex5v7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhqys3e97gbxflrex5v7.png" alt=" " width="748" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If this is your first time working with Bash scripting or functions, it’s a good idea to run the scripts first and observe what they do. Afterwards, come back to read the explanations again,this will help you understand the breakdown more clearly.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>linux</category>
    </item>
    <item>
      <title>Learn Bash Scripting With Me 🚀 - Day 6</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Wed, 17 Sep 2025 18:26:34 +0000</pubDate>
      <link>https://dev.to/babsarena/learn-bash-scripting-with-me-day-6-1i1n</link>
      <guid>https://dev.to/babsarena/learn-bash-scripting-with-me-day-6-1i1n</guid>
      <description>&lt;h2&gt;
  
  
  Day 6 - Ping Sweep
&lt;/h2&gt;

&lt;p&gt;In case you’d like to revisit or catch up on what we covered on Day Five, here’s the link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://dev.to/babsarena/learn-bash-scripting-with-me-day-5-45di
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this lab session, we will create a script that utilizes a &lt;strong&gt;for&lt;/strong&gt; loop, as introduced in the previous post. This exercise will give you a clearer understanding of how &lt;strong&gt;for&lt;/strong&gt; loops are used in practical scenarios. The script we will develop is particularly useful for professionals in penetration testing and cybersecurity.&lt;/p&gt;

&lt;p&gt;The main objective of this script is to ping a set of IP addresses of your choice and determine which ones are online. For example, imagine needing to ping a list of over 200 computers to quickly identify which machines are active on the network—doing this manually would be extremely time-consuming.&lt;/p&gt;

&lt;p&gt;We will begin by defining the interpreter at the top of the script using the shebang &lt;strong&gt;(#!/bin/bash)&lt;/strong&gt;. Additionally, ensure that the script file you create is executable—you should already be familiar with making a file executable by now.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Script
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9oyp7w0pq4vtniwmrqm2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9oyp7w0pq4vtniwmrqm2.png" alt=" " width="800" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image above shows the script created, so I will be explaining the script below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The above is called a &lt;strong&gt;shebang&lt;/strong&gt;, It tells the system to use the &lt;strong&gt;Bash shell&lt;/strong&gt; to run this script.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Creating a simple pingsweep script
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The line above is a &lt;strong&gt;comment&lt;/strong&gt;. In Bash, any text that starts with &lt;strong&gt;#&lt;/strong&gt; is ignored by the interpreter and is not executed as part of the script. Comments are used to provide explanations or notes within your code, making the script easier to understand and maintain for yourself and others.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo “Please enter the first 3 IP address Octet for your environment as shown in the example e.g 10.10.1”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;echo&lt;/strong&gt; command above displays the specified message on the terminal when the script is run. In this case, it prompts the user to enter the first three octets of the IP addresses for their environment (e.g., 10.10.1).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;read SUBNET
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;read&lt;/strong&gt; command captures input from the user and stores it in a variable. In this case, the input provided by the user is saved to the variable &lt;strong&gt;SUBNET&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for IP in $(seq 1 200); do
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In this line, we define a new variable called &lt;strong&gt;IP&lt;/strong&gt;. The $(seq 1 200) generates a sequence of numbers from &lt;strong&gt;1 to 200&lt;/strong&gt;, which the for loop will iterate over. The semicolon &lt;strong&gt;(;)&lt;/strong&gt; is used to separate commands on the same line—it tells the shell that the for statement is complete, and the following do marks the start of the loop’s body.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ping -c2 $SUBNET.$IP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;ping -c2&lt;/strong&gt; command sends two pings to the IP address to check if it is online.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;$SUBNET&lt;/strong&gt; is replaced with the first three parts of the IP address that the user entered.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;dot .&lt;/strong&gt; separates the subnet from the last octet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;$IP&lt;/strong&gt; is the last part of the IP address, which changes from 1 to 200 as the loop runs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Together, this command pings each IP in the range like 10.10.1.1, 10.10.1.2, ..., up to 10.10.1.200.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In Bash, &lt;strong&gt;done&lt;/strong&gt; is used to mark the end of a for loop.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can now run the script by entering the first three octets of your device’s IP address. The script will then check which other devices on your network are online.&lt;/p&gt;

&lt;p&gt;The Output would look like something shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9nnyjkic1tzkwu260g9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9nnyjkic1tzkwu260g9.png" alt=" " width="800" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NB - The output from the script displays the standard results you would get from running a ping command for all 200 IPs.&lt;/p&gt;

&lt;p&gt;You can also stop the script at any time by pressing &lt;strong&gt;Ctrl + C.&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Learn Bash Scripting With Me 🚀 - Day 5</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Mon, 15 Sep 2025 22:12:47 +0000</pubDate>
      <link>https://dev.to/babsarena/learn-bash-scripting-with-me-day-5-45di</link>
      <guid>https://dev.to/babsarena/learn-bash-scripting-with-me-day-5-45di</guid>
      <description>&lt;h2&gt;
  
  
  Day 5 – for loop
&lt;/h2&gt;

&lt;p&gt;In case you’d like to revisit or catch up on what we covered on Day Four, here’s the link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://dev.to/babsarena/learn-bash-scripting-with-me-day-4-fo7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Bash, a &lt;strong&gt;for&lt;/strong&gt; loop is used to &lt;strong&gt;iterate&lt;/strong&gt; over a list of items (strings, numbers, files, command outputs, etc.) and execute a block of code repeatedly for each item.&lt;/p&gt;

&lt;p&gt;It helps automate repetitive tasks without having to write the same command multiple times.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Iterate&lt;/strong&gt; simply means to repeat a process step by step.&lt;/p&gt;

&lt;p&gt;Imagine you have a basket of fruits:&lt;br&gt;
apple, banana, cherry&lt;/p&gt;

&lt;p&gt;If you iterate over the basket, you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Pick up the apple → do something with it.&lt;/li&gt;
&lt;li&gt; Pick up the banana → do something with it.&lt;/li&gt;
&lt;li&gt; Pick up the cherry → do something with it.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Creating A For Loop Script
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First, we’ll create a file that contains a list of fruits. Later, we’ll use this file in a &lt;strong&gt;for&lt;/strong&gt; loop.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1be4isnirtflppm2ujsf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1be4isnirtflppm2ujsf.png" alt=" " width="774" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image above shows a text file I created, named fruits.txt, which contains a list of five fruits.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Script
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62zqof9iy3pl9fs03ole.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62zqof9iy3pl9fs03ole.png" alt=" " width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image above is a simple &lt;strong&gt;for&lt;/strong&gt; loop script created, so I will be explaining the script below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The above is called a shebang, It tells the system to use the Bash shell to run this script.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for FRUITS in $(cat fruits.txt);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The above starts a &lt;strong&gt;for&lt;/strong&gt; loop with &lt;strong&gt;FRUITS&lt;/strong&gt; being the variable name.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$(cat fruits.txt);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The above runs the cat command, which reads the contents of the file fruits.txt.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Purpose of the semicolon&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In Bash, the semicolon (;) is used to separate two commands written on the same line.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The semicolon here tells Bash:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;👉 "The &lt;strong&gt;for&lt;/strong&gt; ... &lt;strong&gt;in&lt;/strong&gt; ... command part is finished, and the next command (do) begins."&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NB- If you write &lt;strong&gt;do&lt;/strong&gt; on a new line, you don’t need the semicolon but I am used to it that's why I included it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;do ... done&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Everything between &lt;strong&gt;do&lt;/strong&gt; and &lt;strong&gt;done&lt;/strong&gt; will run once for each fruit in the list.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "I enjoy eating $FRUITS"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;echo&lt;/strong&gt; prints text to the terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;$FRUITS&lt;/strong&gt; is replaced with the fruits from the list.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wscid35x7kysa3hzbzg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wscid35x7kysa3hzbzg.png" alt=" " width="385" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image above is the output of the script we ran.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ In Summary: This script reads a list of fruits from a file (fruits.txt) and prints a custom message for each fruit using a for loop.&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Learn Bash Scripting With Me 🚀 - Day 4</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Sat, 13 Sep 2025 18:00:00 +0000</pubDate>
      <link>https://dev.to/babsarena/learn-bash-scripting-with-me-day-4-fo7</link>
      <guid>https://dev.to/babsarena/learn-bash-scripting-with-me-day-4-fo7</guid>
      <description>&lt;h2&gt;
  
  
  Day 4 – If and If else conditional statement
&lt;/h2&gt;

&lt;p&gt;In case you’d like to revisit or catch up on what we covered on Day Three, here’s the link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://dev.to/babsarena/learn-bash-scripting-with-me-day-3-4kib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Bash scripting, conditional statements are used to make decisions in your script — i.e., execute certain commands only if a condition is true (or false).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ut3a1712m9infyz4muq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ut3a1712m9infyz4muq.png" alt=" " width="800" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image above is a simple conditional script created, so I will be explaining the script below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Square brackets [ ] are used to define the condition.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Notice that there are spaces around the condition:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ "$NAME" = "Babs" ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If the spaces are missing, Bash will treat it incorrectly (e.g., as variable assignment instead of comparison).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The semicolon ; after ] is important when writing the then statement. It tells Bash that one command (the condition defined in the square bracket) has ended and another (then) begins.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;then&lt;/strong&gt; statement contains the commands to run when the condition is true.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Every &lt;strong&gt;if&lt;/strong&gt; statement must be closed with &lt;strong&gt;fi&lt;/strong&gt;, which marks the end of the statement.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✨ Understanding Bash Conditional Statements In the Image
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp8lvqt61lua9higfbgce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp8lvqt61lua9higfbgce.png" alt=" " width="800" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When creating the conditional statement to check if the variable is equal to "Babs", we spaced it because:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If we do not space it, it would mean that we are trying to change the variable for "NAME" which we already defined.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;We also end the conditional statement after closing the square bracket with a semicolon ";" because:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We are joining two commands together.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What I mean by that is because we want the statement to do something based on the condition described, which is why the &lt;strong&gt;then&lt;/strong&gt; statement was included in order to tell it to:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "welcome boss"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;And also note that:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We always close an &lt;strong&gt;if&lt;/strong&gt; statement with &lt;strong&gt;fi&lt;/strong&gt;, or else the script will fail.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;fi&lt;/strong&gt; denotes the end of the &lt;strong&gt;if&lt;/strong&gt; statement.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn0pe56fkv95m83nyzxel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn0pe56fkv95m83nyzxel.png" alt=" " width="650" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above is the output of the script&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ The if-else Statement
&lt;/h2&gt;

&lt;p&gt;Now for the if/else&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi08nvt8tqzo9kn3pimvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi08nvt8tqzo9kn3pimvc.png" alt=" " width="800" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create and run the above script and see the outcome.&lt;/li&gt;
&lt;li&gt;By now you should be familiar with the &lt;strong&gt;echo&lt;/strong&gt; and &lt;strong&gt;read&lt;/strong&gt; command&lt;/li&gt;
&lt;li&gt;So in the above script created, the &lt;strong&gt;echo&lt;/strong&gt; displays the instruction for us to enter our username&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;read&lt;/strong&gt; command takes input from us and saves it as the variable &lt;strong&gt;NAME&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;So the &lt;strong&gt;if&lt;/strong&gt; statement would check if the username is equal to &lt;strong&gt;Babs&lt;/strong&gt; which if it is will then echo the information &lt;strong&gt;“welcome back boss”&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;And the &lt;strong&gt;else&lt;/strong&gt; is to display something else if the name is not equal to Babs so it will echo &lt;strong&gt;"who are you"&lt;/strong&gt; and then the &lt;strong&gt;fi&lt;/strong&gt; is to signify the end of the if statement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F45njdubpqgag286rqfcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F45njdubpqgag286rqfcx.png" alt=" " width="800" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above image is the output of the script when the name is equal to Babs&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0s45jy6m10rdoec76tu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0s45jy6m10rdoec76tu.png" alt=" " width="683" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above is the output when the name is something else other than Babs.&lt;/p&gt;

&lt;h2&gt;
  
  
  🏁 Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use [ ] to wrap conditions in Bash.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always keep spaces around brackets and operators.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;strong&gt;then&lt;/strong&gt; to specify what should happen if the condition is true.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;strong&gt;else&lt;/strong&gt; to define an alternative action.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Close every conditional block with fi.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These basics of if and if-else lay the foundation for more advanced conditionals.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Learn Bash Scripting With Me 🚀 - Day 3</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Fri, 12 Sep 2025 18:46:39 +0000</pubDate>
      <link>https://dev.to/babsarena/learn-bash-scripting-with-me-day-3-4kib</link>
      <guid>https://dev.to/babsarena/learn-bash-scripting-with-me-day-3-4kib</guid>
      <description>&lt;h2&gt;
  
  
  Day 3 – User Input and Comments
&lt;/h2&gt;

&lt;p&gt;In case you’d like to revisit or catch up on what we covered on Day Two, here’s the link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://dev.to/babsarena/learn-bash-scripting-with-me-day-2-36k0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When writing Bash scripts, it’s often useful to get input directly from the user. This allows your script to be interactive and dynamic. Let’s walk through how to use the "read" command in Bash to achieve this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgpv7lnt9wugrmspo4t3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgpv7lnt9wugrmspo4t3.png" alt=" " width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The below would clearly explain what you see in the image above.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Declaring the Shell
&lt;/h2&gt;

&lt;p&gt;Every Bash script should start by declaring the shell that will interpret the script. We do this using the shebang:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells the system to use Bash when executing the script.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Using read with -p
&lt;/h2&gt;

&lt;p&gt;The read command is used to take input from the user.&lt;br&gt;
Adding the -p option lets you display a prompt before the input is taken.&lt;br&gt;
you will understand this better when you run the script, it’s almost the same thing as using the command echo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

read -p "Please enter your name: " NAME
echo "Your name is $NAME"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;read -p "Enter your name: " → Displays the text before waiting for user input.&lt;/p&gt;

&lt;p&gt;NAME → The variable where the input is stored.&lt;/p&gt;

&lt;p&gt;echo "Your name is $NAME" → Prints the stored input.&lt;/p&gt;

&lt;p&gt;PS- Run the script and show your outcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Adding Comments
&lt;/h2&gt;

&lt;p&gt;Comments are basically used  to describe something in your own word, which is basically you leaving a comment in the script so you can make your script more readable or explanatory for other people and this is done using “#” and it tells the script not to add it to the list of things to run.&lt;/p&gt;

&lt;p&gt;Just as seen in the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpsalruybi2zsjrfor66.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpsalruybi2zsjrfor66.png" alt=" " width="800" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

# This script asks the user for their name
read -p "Enter your name: " NAME

# Output the name back to the user
echo "Your name is $NAME"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NB- Anything after # is ignored by the script when it runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Another Way to Use read (Multiple Variables)
&lt;/h2&gt;

&lt;p&gt;Instead of using -p, you can first use echo to display instructions, and then use read to take multiple inputs at once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi55fkcsxrackir4egl1p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi55fkcsxrackir4egl1p.png" alt=" " width="800" height="173"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

# Ask for first name and last name
echo "Kindly enter your first name and last name: "
read FNAME LNAME

echo "Your name is $FNAME $LNAME"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;echo "Enter your first name and last name: " → Displays a message.&lt;/p&gt;

&lt;p&gt;read FNAME LNAME → Takes two inputs: the first is stored in FNAME, the second in LNAME.&lt;/p&gt;

&lt;p&gt;echo then displays both variables.&lt;/p&gt;

&lt;p&gt;My outcome is shown below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuox4cjjehy778dios7e2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuox4cjjehy778dios7e2.png" alt=" " width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Don’t Forget Executable Permission
&lt;/h2&gt;

&lt;p&gt;Before running your script, make sure it has executable permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Learn Bash Scripting With Me 🚀 - Day 2</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Thu, 04 Sep 2025 21:20:21 +0000</pubDate>
      <link>https://dev.to/babsarena/learn-bash-scripting-with-me-day-2-36k0</link>
      <guid>https://dev.to/babsarena/learn-bash-scripting-with-me-day-2-36k0</guid>
      <description>&lt;h2&gt;
  
  
  Day 2 – Variables
&lt;/h2&gt;

&lt;p&gt;In case you’d like to revisit or catch up on what we covered on Day One, here’s the link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://dev.to/babsarena/learn-bash-scripting-with-me-day-1-1ekd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Variables in Bash scripting are used to store data, such as numbers, text, or file paths. They are a way to label and reference information that can be used later in a script.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We begin by creating a file using any text editor of our choice and naming it variables.sh.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Declaring the Shell
&lt;/h2&gt;

&lt;p&gt;At the very top of the script, specify the shell you want to use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating a Variable
&lt;/h2&gt;

&lt;p&gt;Let’s create a variable called NAME.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr02474dz2vigpik9stn5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr02474dz2vigpik9stn5.png" alt=" " width="334" height="108"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Best Practice:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Variable names in Bash are usually written in capital (block) letters.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using lowercase will still work, but uppercase is the recommended convention.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Important Rules When Declaring Variables
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No spaces before or after the = sign, otherwise the script will fail.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NAME = "Babs"    ❌ Invalid&lt;br&gt;
NAME="Babs"      ✅ Valid&lt;/p&gt;

&lt;p&gt;NB - Strings must be inside quotes (" ").&lt;/p&gt;

&lt;p&gt;NB - Numbers don’t need quotes.&lt;/p&gt;

&lt;p&gt;AGE=25           ✅ Valid&lt;br&gt;
CITY="Nairobi"   ✅ Valid&lt;/p&gt;
&lt;h2&gt;
  
  
  Using Variables
&lt;/h2&gt;

&lt;p&gt;To call a variable, use the dollar sign ($):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "My name is $NAME"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;NB - You can also use curly braces {} when combining variables with text:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SPORT="Foot"&lt;br&gt;
echo "The most popular sport is ${SPORT}ball"&lt;br&gt;
Output: The most popular sport is Football&lt;/p&gt;
&lt;h2&gt;
  
  
  Pictorial Examples of the script and the outcome
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Script 1&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx2ogwb1o0bfc4gt7iame.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx2ogwb1o0bfc4gt7iame.png" alt=" " width="729" height="253"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Script 1 Outcome:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fec89m9g3d84xv9hf6j9i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fec89m9g3d84xv9hf6j9i.png" alt=" " width="579" height="103"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Script 2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvdevwilqb1hg31078e4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvdevwilqb1hg31078e4.png" alt=" " width="634" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Script 2 Outcome:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcuxt4r0mt5fg99uevqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcuxt4r0mt5fg99uevqj.png" alt=" " width="478" height="109"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Naming Rules
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Variable names must start with an alphabet (A–Z or a–z).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They cannot start with a number.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;01_NAME="Test"   # ❌ Invalid&lt;br&gt;
NAME_01="Test"   # ✅ Valid&lt;br&gt;
SPORT_07="Test"  # ✅ Valid&lt;/p&gt;

&lt;p&gt;NB - If variables are not properly declared, the script will return an error.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔎 Things to Keep in Mind
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If your script fails to run, ensure that the file is executable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can check this with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -la
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If it’s not executable, make it executable with:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x variables.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Always enclose string variables in quotation marks (" ").&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Missing quotes may cause your script to fail.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✨ And that’s the foundation of working with variables in Bash scripting for day 2!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Learn Bash Scripting With Me 🚀 - Day 1</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Tue, 02 Sep 2025 21:59:36 +0000</pubDate>
      <link>https://dev.to/babsarena/learn-bash-scripting-with-me-day-1-1ekd</link>
      <guid>https://dev.to/babsarena/learn-bash-scripting-with-me-day-1-1ekd</guid>
      <description>&lt;h2&gt;
  
  
  LearnBashScriptingWithMe 🚀
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Day 1 – Introduction, Shebang &amp;amp; File Permissions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Bash scripting is the process of creating a file that contains a sequence of commands and then running that file as a script.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A shell in Kali Linux is a command-line interpreter that provides an interface for the user to interact with the operating system. It allows users to execute commands, scripts, and programs to manage the system, navigate the file system, and perform various administrative tasks.&lt;/p&gt;

&lt;p&gt;👉 We start by creating a file using the “sh” extension as this is used to denote that we are creating a shell script, e.g test.sh&lt;/p&gt;

&lt;p&gt;👉 After that the next thing we need to do is to define the kind of interpreter we are going to be using and for this, the interpreter is BASH and we denote that using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 Inside the script, we can use the echo command to display output. For example, printing “Hello World!”&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Hello World!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98ewoghtt5q1lqfx96ud.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98ewoghtt5q1lqfx96ud.png" alt=" " width="800" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Now we can now save and run the script by using the command “./(filename)” &lt;br&gt;
e.g:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./test.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the command &lt;strong&gt;"./"&lt;/strong&gt; is telling the shell to use the interpreter defined in the file we want to run which was what was defined first when we wrote &lt;strong&gt;"#!/bin/bash"&lt;/strong&gt; in the file&lt;/p&gt;

&lt;p&gt;But notice—you might get a “permission denied” error. That’s because the file isn’t yet executable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0enxetqxxjdrvqwnfc2b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0enxetqxxjdrvqwnfc2b.png" alt=" " width="705" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 To fix this, grant execution permission with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x test.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, when you run ./test.sh, the script executes successfully 🎉&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdvg1524188ni2s1vyz1j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdvg1524188ni2s1vyz1j.png" alt=" " width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Bash #scripting
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>🐍 Using Python Web Server to Share Files Across VMs and OSes</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Mon, 14 Jul 2025 23:02:40 +0000</pubDate>
      <link>https://dev.to/babsarena/using-python-web-server-to-share-files-across-vms-and-oses-288m</link>
      <guid>https://dev.to/babsarena/using-python-web-server-to-share-files-across-vms-and-oses-288m</guid>
      <description>&lt;p&gt;In my work environment, I deal with multiple operating systems hosted on different virtual machines. A frequent challenge I face is transferring files between these systems — especially when copy-paste and drag-and-drop functionalities are disabled for security reasons.&lt;/p&gt;

&lt;p&gt;Ideally, if all these systems existed within the same Active Directory (AD) domain, I could’ve easily used a shared network folder. But that’s not the case. Fortunately, I discovered a simple yet powerful solution using… Python!&lt;/p&gt;

&lt;p&gt;Who would’ve thought a snake 🐍 would solve my file-sharing problem?&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ The Quickest Cross-OS File Sharing Method
&lt;/h2&gt;

&lt;p&gt;With Python’s built-in web server, I can now instantly share files between any operating system — as long as they’re on the same network. It’s basically the fastest version of AirDrop I’ve ever seen for VMs and local systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔧 How to Set Up a Python Web Server on Windows
&lt;/h2&gt;

&lt;p&gt;Here’s a step-by-step guide to setting it up:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Install Python&lt;/strong&gt;&lt;br&gt;
Go to the official Python website and download the latest version.&lt;/p&gt;

&lt;p&gt;During installation, make sure to check the box that says “Add Python to PATH” (important!).&lt;/p&gt;

&lt;p&gt;Complete the installation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyy4txsr9h5s1z9org408.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyy4txsr9h5s1z9org408.png" alt=" " width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Verify or Manually Add Python to System Environment Variables&lt;br&gt;
In case Python isn't added to PATH automatically:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press the Windows key, search for Python, right-click on the one that shows “(64-bit)”, and choose Open File Location.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqbku36opeotewk2v0mq9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqbku36opeotewk2v0mq9.png" alt=" " width="800" height="649"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F858knvers038b66domf1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F858knvers038b66domf1.png" alt=" " width="389" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the path (e.g., C:\Users\YourName\AppData\Local\Programs\Python\Python311)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6c4virtgcr21ssx34we.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6c4virtgcr21ssx34we.png" alt=" " width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now, add this path to the system environment variables:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Search for “Environment Variables” in Windows search.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Under System Properties, click Environment Variables.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdk68k6ulyafc3xvs9uy3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdk68k6ulyafc3xvs9uy3.png" alt=" " width="624" height="707"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under System variables, click New.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87nm8m5sggg2fg2ah84m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87nm8m5sggg2fg2ah84m.png" alt=" " width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For Variable Name, you can enter something like PYTHON.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For Variable Value, paste the copied Python path.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdm0gnj9xh2s9d3ft813.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdm0gnj9xh2s9d3ft813.png" alt=" " width="800" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click OK and save.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Start the Python Web Server&lt;br&gt;
Open Command Prompt (CMD), navigate to the folder you want to share, and run:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python -m http.server 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Or if python doesn’t work, try:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -m http.server 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This starts a basic web server that serves files from the current folder on port 8080.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3iz1qy4xmku4twk0n44n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3iz1qy4xmku4twk0n44n.png" alt=" " width="800" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Access the Server from Another Device&lt;br&gt;
Now on any device (Windows, Linux, macOS, Android, etc.) connected to the same network, open a browser and type:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://&amp;lt;IP_ADDRESS&amp;gt;:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://192.168.8.102:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This opens the hosted directory in a browser — allowing you to download files easily and it can also be gotten via phones to.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5jvd03pwiufp8m6z6ae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5jvd03pwiufp8m6z6ae.png" alt=" " width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1vfas7onu4xg72oyah2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1vfas7onu4xg72oyah2.png" alt=" " width="800" height="1778"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚠️ Troubleshooting Tip
&lt;/h2&gt;

&lt;p&gt;If you get an error saying 'python' is not recognized as an internal or external command, it means Python isn’t properly installed or added to the system PATH.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Just type "python" in CMD.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If it redirects you to the Microsoft Store, download Python from there.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then repeat the earlier steps to set it up properly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✅ Final Thoughts
&lt;/h2&gt;

&lt;p&gt;With this method, I no longer struggle with sharing files across different virtual machines and OS environments. It’s lightweight, doesn't require external tools, and works instantly over LAN.&lt;/p&gt;

&lt;p&gt;Python just became my new best friend for file sharing — fast, simple, and cross-platform.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🔐 How I Granted Local Admin Rights to a User Without Compromising Domain Security</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Sun, 22 Jun 2025 21:50:06 +0000</pubDate>
      <link>https://dev.to/babsarena/how-i-granted-local-admin-rights-to-a-user-without-compromising-domain-security-1daj</link>
      <guid>https://dev.to/babsarena/how-i-granted-local-admin-rights-to-a-user-without-compromising-domain-security-1daj</guid>
      <description>&lt;p&gt;In an enterprise environment, it’s common to restrict admin access on user machines using Active Directory (AD) policies. But what happens when a team member urgently needs elevated privileges—outside work hours and without VPN access?&lt;/p&gt;

&lt;p&gt;That’s exactly the situation I faced recently. Here’s how I resolved it efficiently by granting local admin rights—without compromising domain security.&lt;/p&gt;

&lt;h2&gt;
  
  
  📌 Scenario Overview
&lt;/h2&gt;

&lt;p&gt;A team member was working on a time-sensitive project that required:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Installing applications&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Running scripts or commands with admin privileges&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;However:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The AD setup restricts such actions to domain admins only&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;She would be working after-hours and during the weekend&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;She suggested calling me whenever she needed admin access so I could remotely control her screen and enter the credentials for her. However, this would be time-consuming and impractical in the long run.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ The Solution
&lt;/h2&gt;

&lt;p&gt;Instead of providing domain admin access (which poses a security risk), I granted her local administrator privileges on her system only.&lt;/p&gt;

&lt;p&gt;🔐 Note: Local admin rights only apply to the specific machine. This doesn't make the user a domain admin.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧭 Step-by-Step Walkthrough
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. 🔓 Open an Elevated Command Prompt&lt;/strong&gt;&lt;br&gt;
open Command Prompt as Administrator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. ➕ Add the User to the Local Administrators Group&lt;/strong&gt;&lt;br&gt;
Run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net localgroup administrators "YOURDOMAIN\username" /add
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net localgroup administrators "ETCG\john.doe" /add
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ This command tells the local machine to treat john.doe as a system administrator—on that PC only&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. 🔍 Confirm It Worked&lt;/strong&gt;&lt;br&gt;
To verify the user was successfully added, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net localgroup administrators
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the domain user listed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;YOURDOMAIN\username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That confirms they now have admin rights on the system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. ✅ What the User Can Now Do&lt;/strong&gt;&lt;br&gt;
With local admin privileges, the user can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Install software&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run commands or scripts with elevated permissions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make system changes without needing your intervention&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And since it’s tied to her domain account on that system, she simply uses her own password for elevation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. 🔒 Removing Local Admin Access (After Project Completion)&lt;/strong&gt;&lt;br&gt;
Once the project is done and elevated privileges are no longer needed, revoke access by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net localgroup administrators "YOURDOMAIN\username" /delete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net localgroup administrators "ETCG\john.doe" /delete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This safely removes her from the local admin group, restoring the default security posture.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It's a least-privilege approach—user has elevated access only where and when needed&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always remember to remove access when no longer required&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re in a similar situation, this method strikes the right balance between user productivity and security hygiene. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Exploring Wazuh SIEM Capabilities in a Hands-On Lab Session</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Tue, 10 Jun 2025 21:14:40 +0000</pubDate>
      <link>https://dev.to/babsarena/exploring-wazuh-siem-capabilities-in-a-hands-on-lab-session-442o</link>
      <guid>https://dev.to/babsarena/exploring-wazuh-siem-capabilities-in-a-hands-on-lab-session-442o</guid>
      <description>&lt;p&gt;A while ago, I had the opportunity to lead a practical session with a few of my students, where we explored the power and flexibility of Wazuh—a free, open-source security platform offering extended detection and response (XDR) and SIEM capabilities.&lt;/p&gt;

&lt;p&gt;The goal of the session was to help them understand how Wazuh can be used to monitor system integrity, detect malware, and centralize security operations. Here's a detailed breakdown of what we covered during the lab:&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ Deploying Wazuh &amp;amp; Integrating Agents
&lt;/h2&gt;

&lt;p&gt;We started with deploying Wazuh and installing its agent on both Kali Linux and Windows OS systems in our lab environment. The students learned how to ensure the agent is properly connected and visible within the Wazuh dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ SSH Access for Easier Configuration
&lt;/h2&gt;

&lt;p&gt;One of the key things I emphasized was the importance of SSH access to the Wazuh server. Since the Wazuh CLI doesn’t support easy copy-paste functionality, making changes or executing multiple commands can be tedious. By SSHing into the Wazuh server from either Kali Linux or Windows, students could seamlessly copy and paste configuration commands—dramatically improving efficiency during setup and troubleshooting.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ Changing the Wazuh Admin GUI Password
&lt;/h2&gt;

&lt;p&gt;A critical security aspect I demonstrated was how to change the Wazuh admin GUI password. As this cannot be done directly from the GUI interface, I walked them through the proper process using the Wazuh CLI. This highlighted the importance of CLI proficiency when managing SIEM tools like Wazuh.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ File Integrity Monitoring (FIM)
&lt;/h2&gt;

&lt;p&gt;Next, we moved on to one of Wazuh's most powerful features—File Integrity Monitoring. I guided the students in setting up FIM on the Downloads directory of Kali Linux. Once configured, Wazuh started monitoring file changes in real-time.&lt;/p&gt;

&lt;p&gt;We created and modified test files and observed how Wazuh instantly reported those changes. Impressively, the system not only flagged that a change had occurred but also showed precisely what was modified—a critical feature for forensic investigations and compliance tracking.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foks1m1o6t9bha0lnf2a7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foks1m1o6t9bha0lnf2a7.png" alt="Image description" width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31ebokszo8gsnv0flzqa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31ebokszo8gsnv0flzqa.png" alt="Image description" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ VirusTotal Integration &amp;amp; Malware Detection
&lt;/h2&gt;

&lt;p&gt;To extend Wazuh's capabilities, we integrated VirusTotal by adding API keys to our configuration. This enabled Wazuh to scan files against VirusTotal’s extensive malware database.&lt;/p&gt;

&lt;p&gt;To test this integration, we downloaded the EICAR test file—a harmless file used to test malware detection systems. Wazuh, now integrated with VirusTotal, flagged the file as malware and automatically removed it upon detection. This real-time response to malware threats reinforced the power of Wazuh in endpoint protection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xq5nbzed5hcuok15tdt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xq5nbzed5hcuok15tdt.png" alt="Image description" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0aeo8y4eo93ythwm3yzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0aeo8y4eo93ythwm3yzj.png" alt="Image description" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ Student Assignment: Windows FIM Setup
&lt;/h2&gt;

&lt;p&gt;To wrap up the session, I assigned a practical challenge: each student was to replicate the File Integrity Monitoring setup and VirusTotal integration—but this time on their Windows operating system. This not only ensured they could apply what they learned independently but also gave them the opportunity to explore platform-specific nuances.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This session showcased just a few of the powerful capabilities that Wazuh offers for security operations. From agent management and file monitoring to malware detection and real-time alerting, Wazuh provides a unified platform that’s both accessible and deeply customizable.&lt;/p&gt;

&lt;p&gt;For students and professionals stepping into the world of cybersecurity and SIEM tools, hands-on experience like this is invaluable. I’m glad to have been able to guide them through this and look forward to seeing how they build on these skills in the future.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>💡 Real-World Cybersecurity Experience: Teaching Wazuh Deployment and Troubleshooting</title>
      <dc:creator>Babs</dc:creator>
      <pubDate>Fri, 06 Jun 2025 02:07:11 +0000</pubDate>
      <link>https://dev.to/babsarena/real-world-cybersecurity-experience-teaching-wazuh-deployment-and-troubleshooting-1n0i</link>
      <guid>https://dev.to/babsarena/real-world-cybersecurity-experience-teaching-wazuh-deployment-and-troubleshooting-1n0i</guid>
      <description>&lt;p&gt;Recently, I guided a few of my students through a hands-on deployment of Wazuh, a powerful and open-source platform for Extended Detection and Response (XDR) and Security Information and Event Management (SIEM). Wazuh helps organizations detect threats, monitor system integrity, and maintain compliance across various environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ What We Did
&lt;/h2&gt;

&lt;p&gt;We began by deploying Wazuh in a lab environment and successfully installed Wazuh agents on both a Linux and a Windows machine. I demonstrated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;How to access the Wazuh web interface via its IP address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to SSH into the Wazuh server from both Windows and Linux.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to install and link a Linux machine using the Wazuh agent.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything went smoothly with the Linux integration. After that, I showed them how to install the agent on a Windows machine — &lt;strong&gt;but deliberately stopped short of completing the link successfully.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 The Assignment
&lt;/h2&gt;

&lt;p&gt;I tasked the students with figuring out why the Windows agent failed to register with the Wazuh manager. My goal was to simulate real-world conditions, because as any cybersecurity engineer knows: &lt;strong&gt;deployments often come with challenges,&lt;/strong&gt; and troubleshooting is part of the daily job.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 Their Observations
&lt;/h2&gt;

&lt;p&gt;The students investigated the issue and noticed that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The authentication key for the Windows agent wasn’t being generated or displayed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Even after attempting to manually link the agent via the Windows CLI, the issue persisted.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They brainstormed potential causes and suspected it had something to do with the agent’s authentication key.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 The Real Issue
&lt;/h2&gt;

&lt;p&gt;Eventually, I stepped in to guide them through the problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Wazuh manager we deployed was version 4.11.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They had installed the Wazuh agent version 4.12 on Windows.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because of this version mismatch, the Windows agent could not successfully register with the Wazuh manager.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ The Fix
&lt;/h2&gt;

&lt;p&gt;Here’s how we resolved it:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Uninstalled the incorrect agent version (4.12) on the Windows machine.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Installed the correct agent version (4.11) to match the Wazuh manager.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Configured the agent with the manager’s IP.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At this point, they tried to link the Windows agent to Wazuh, but the authentication key still wasn’t appearing, and they couldn’t figure out why. After some investigation, I revealed the missing piece:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Restarting the Wazuh agent on the Windows machine after inputting the necessary details.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once we restarted the agent, everything clicked into place, and the link was successfully established.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Always match the agent version with the Wazuh manager version.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Restarting services can resolve issues after configuration changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Real-world cybersecurity engineering involves constant troubleshooting — things rarely work on the first try.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating structured problems for learners helps them develop resilience, critical thinking, and a practical mindset.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This experience reminded all of us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Sometimes, all you need is the right version and a good restart.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s the reality of being a cybersecurity engineer. 🔐&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
