T3chnocr4t:~#

Looking 🔭 For Something Hidden....

View on GitHub

Bash Scripting 💻:~#


In this article, we’ll explore Bash scripting together, where I’ll share what I’ve learned. While I’m not an expert, I can help guide you through everything you need to know about Bash scripting by sharing my insights.

Introdution:~#

Bash scripting refers to the process of writing scripts using the Bash (Bourne Again Shell) programming language, which is the default command-line interpreter in most Unix-like operating systems, including Linux 🐧 and macOS.

Bash scripting helps users automate tasks, create workflows, and control system resources using commands. It lets users run commands, change files, manage processes, and handle system administration tasks using a powerful scripting language.

Why Use Bash Scripting :sunglasses:~#

  1. Automation: Saves time by automating repetitive tasks.
  2. Customization: Tailors computing environment to specific needs.
  3. Task Automation: Automates file management, data processing, and more.
  4. System Administration: Manages users, monitors systems, and schedules backups.
  5. Cross-Platform Compatibility: Runs on Linux, macOS, and BSD systems.
  6. Integration: Works well with other languages and tools for complex workflows.
  7. Learning and Education: Helps develop programming,cybersecurity and problem-solving skills.

Essential Components and Concepts in Shell Scripting:~#

  1. Text Editor: Choose a text editor to write your script. Common options include Vim, Emacs, Nano, Visual Studio Code, Sublime Text.
  2. Shebang: It’s the first line of a script that tells the computer which interpreter to use.
  3. File Extension: Scripts often end with .sh, but it’s not always necessary.
  4. Permissions: Scripts need permission to run. You make them executable using the chmod +x command.
  5. Arguments: You can give a script information to work with when you run it.
  6. Variables: They’re containers that store information in a script.
  7. If Statements: They help the script make decisions based on certain conditions.

Understanding these basics will help you start writing simple scripts to automate tasks on your computer.

A simple Scripts:~#

Below are some simple scripts that will help you understand the concepts of Bash scripting:

Screenshot_2024-01-28_04-33-05 (2)

Screenshot_2024-01-28_04-35-00 (2)

Screenshot_2024-01-28_04-36-54 (2)

Variable:~#

Screenshot_2024-01-28_04-39-21 (2)

You can observe that the script echoes the variable, i.e., the variable name and age, out there.

Screenshot_2024-01-28_04-40-06 (2)

Thanks

That’s just the beginning for us! Join me at my GitHub profile, where we’ll delve into other scripts and explain what we’ll be learning, such as if statements, while loops, and much more. Together, we’ll create some useful scripts that we can leverage in the future 😄 .