Archives for Scripting - Page 2
Loop through a date range in Shell Script
Loop through a date range in Shell Script Here is a simple shell script which accept two date value as argument and perform desired action for date value in #!/usr/bin/bash…
Pass date as mandatory arguments in bash script
Pass date as mandatory arguments in bash script I came across a use case where I have to write a shell script to perform some action on two date ranges.…
How to define multiline string variable in shell?
How to define multiline string variable in shell? In your bash/shell scripting experience you may face scenario where you need to define multi line string variable. Here is multiple ways…
How to read a config file in Python
How to read a config file in Python: This article will help you to read config based on the environment. For example, If you have a python script which uses…
How to run multiple bash scripts in parallel
If you working as a Linux administrator or as a DevOps engineer then you might get a use case where you need to run multiple bash scripts in parallel without…
Get the last ten business days in a Unix shell script
Shell script to get the last 10 weekdays and run some task for each date over an element array. #!/usr/bin/bash n=10 today=$(date +'%Y-%m-%d') for ((d=1; n>0; d++)) do # Adjust…
Shell script to pass multiple arguments with options
Shell script to pass multiple arguments with options This tutorial will help you to pass multiple arguments in a more organized manner. I have used two arguments "t" and "d"…
How to Run a Shell Script in Infinite Loop
You can run a shell script in infinite loop by using while loop. #!/bin/bash while true do echo "Press CTRL+C to stop the script execution" # Enter your desired command in…
Cut and paste in Vim editor
Here is the simple step by step guideline to cut and paste in Vim editor. Press esc if vim editor in insert mode Position the cursor where you want to…
How to Run a Linux Script During Reboot or Startup
How to Run a Linux Script During Reboot or Startup I come across one use case where I need to run a Linux script during reboot or startup of the…