Skip to main content

Command Palette

Search for a command to run...

Some Basic information about shell scripting

Published
โ€ข2 min readโ€ขView as Markdown
Some Basic information about shell scripting
G

I'm Good in a variety of DevOps technologies, including AWS, Linux, Python, Shell Scripting, Docker, Terraform, Jenkins, Git/GitHub, and Computer Networking. I have a strong ability to troubleshoot and resolve issues and am consistently motivated to expand my knowledge and skills through the exploration of new technologies.

Hey there fellow shell scripters! ๐Ÿ˜„๐Ÿš I'm super excited to share some more basic commands and information that we use in our bash/shell scripts! ๐Ÿ’ป Here they are

#!/bin/bash: itโ€™s called Shebang a shebang (also known as a hashbang) is a special line at the beginning of a script file that tells the computer how to interpret and execute the script. It starts with the character "#!"

  1. Variable: In Linux Variable is like a container that can store the data or It's like a temporary storage location for values that can be used and manipulated by commands and scripts. Variables can hold different types of information, such as numbers, text, file paths, and more.

Types of variables:

  1. System Variables: this variable is predefining variable in Linux and it always shows in capital letters ex: $PATH, $Home, $User, $PWD

  2. User Define Variables: this variable defines by the user, and it is not case sensitive ex: $count, $user, etc.

2. Arguments: arguments in a Linux command are additional pieces of information or options that you provide to a command to modify its behavior or specify what operation it should perform for example generally you see while we install any software through a command it asks to type โ€œyesโ€ โ€œnoโ€ it is called an argument

One more example is when we type the โ€œlsโ€ command to see a list of directories/files similarly we use โ€œls -aโ€ to see the hidden file in Linux so in this command we used โ€œ-a โ€œthis called variable, Hope you understood the concept of the variable by these examples.

3. Loop: loop commands in Linux refer to a way of repeating a series of actions or commands multiple times. It allows you to automate tasks by executing the same set of instructions repeatedly until a certain condition is met.

There are two commonly used loop commands in Linux:

1. For Loop: This loop allows you to execute a sequence of commands a specified number of times. For example, you could run a command ten times or iterate over a list of items, performing an action on each item.

2. While Loop: With a while loop, you repeat a block of commands as long as a specific condition remains true. Once the condition becomes false, the loop stops.

Both types of loops are valuable for automating tasks, managing files, and processing data efficiently in the Linux command-line environment.

#education #shellscripting #90daysofdevops #trainwithshubham #technology #everydaylearning #hiring #devopscommunity #linuxworld #jobfinder