Hello world!
Welcome to Starter Templates Sites. This is your first post. Edit or delete it, then start writing!
Welcome to Starter Templates Sites. This is your first post. Edit or delete it, then start writing!
Here are few preferred ways to concatenate string variables in bash script Concatenate string variables in Bash 1.Write the variable one after another in echo 2. Use += assignment operator: Second method can be used to append to an integer as well test.sh
Here are the couple of methods to check if a string contains a substring in bash shell script. Methods to check if string contains a substring in Bash Method 1: Use regular expression Output: Method 2: Use wildcard (*) to check the string Output:
If you dealing with number of servers in day to day basis and if your application is growing rapidly then you may come across with different environment variable which you have to update manually bashrc files. What if you have 10+ environment then it will difficult for you to update the bash profile file manually….
Check if file does not exist in Bash Script? You can use -f option in bash script to check if file does not exist. Check if file does not exists if [ ! -f /tmp/users.txt ]; then echo “File not found” fi Parameterize file name in script to check if file doesn’t exist filecheck.sh Check…
How to check if a directory exists in a bash script? In shell script implementation you might come across use case where you need to perform some operation in a directory, but what if directory is not present then your script might break. To avoid the failure and display user friendly error, we should validate…
Write a python program to find the largest and smallest number in python using for loop Assign first element of an array to largest(lt) and smallest (st) value variable. Traverse the array by using for loop If element of array a[i] is smaller than first element of variable st then assign array element to st….
Find two numbers whose sum is equal to a given number in sorted array In order to find the sum of the two array elements you need to traverse in array and check the sum of each element. Let’s take an example of below sorted array in which we have to perform below iteration to find the sum of the array element. [1, 5, 6, 8, 10] First Iteration: 1 51 61 81 10 Second Iteration:5 65 85 10…
Write a Program in Python to execute Bubble sort program What is Bubble Sort Program ? Bubble sort is a simple sorting algorithm that compares adjacent elements and swaps them if they are in the wrong order. It will compares through the list until the list is completely sorted. Let’s take this array “6, 1,…
The Fibonacci numbers, commonly refers as Fibonacci sequence, in which each number is the sum of the two preceding numbers, starting from 0 and 1. The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … # Program to print Fibonacci sequence for 7 numbers #fibonacci.py terms…