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 "#!"
- 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:
System Variables: this variable is predefining variable in Linux and it always shows in capital letters ex: $PATH, $Home, $User, $PWD
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