DEV Community

Cover image for CONCLUSION ON BASH SCRIPTING
Kenneth Mahon
Kenneth Mahon

Posted on

CONCLUSION ON BASH SCRIPTING

Good day Everyone; i'm so sorry i haven't been consistent updating us on my journey so far; work have really been demanding this days and taking alot of time but notwithstanding, my journey is not fading away.
i won't be consistent in posting due to work but the 120 days of Learning devOps still intact; surely going to achieve it.

to round up bash scripting before moving to python, i will be rounding up by sharing some scripting; interpret it and run it to see the result. i will also sharing a resources that covers all we have discussed about in my previous post on bash scripting
LET GOOOOOO!!!!!!

script 1

#!/bin/bash


read -p "Enter file name: " file_name
read -p "Enter search term: " search_term

if [ ! -f $file_name ]; then
    echo "File not found"
    exit 1
fi

while read line
do
    if [[ $line == *"$search_term"* ]]; then

        new_line=${line//$search_term/new_value}
        echo $new_line
    else
        echo $line
    fi
done < $file_name
Enter fullscreen mode Exit fullscreen mode

script 2

for file in *.txt; do
  mv "$file" "${file%.txt}.doc"
done
Enter fullscreen mode Exit fullscreen mode

Script 3

while ps -p 1234 >/dev/null; do
    sleep 1
done
Enter fullscreen mode Exit fullscreen mode

That is all. play with it and share your interpretation and output in the comment section. Day 15 loading.......

RESOURCES:
Bash scripting for beginners

Redis image

Short-term memory for faster
AI agents

AI agents struggle with latency and context switching. Redis fixes it with a fast, in-memory layer for short-term context—plus native support for vectors and semi-structured data to keep real-time workflows on track.

Start building

Top comments (0)

Build gen AI apps that run anywhere with MongoDB Atlas

Build gen AI apps that run anywhere with MongoDB Atlas

MongoDB Atlas bundles vector search and a flexible document model so developers can build, scale, and run gen AI apps without juggling multiple databases. From LLM to semantic search, Atlas streamlines AI architecture. Start free today.

Start Free

👋 Kindness is contagious

Sign in to DEV to enjoy its full potential—unlock a customized interface with dark mode, personal reading preferences, and more.

Okay