Author Archives: Roopendra - Page 6
Loop through business day and previous business day in shell
Shell script loop to execute some task for business day and previous business day. If previous business day is weekend then script should skip the weekend date and pick Friday as a previous business day date. #!/bin/bash N=5 for i in $(seq $(($N + $N / 5 * 2)) -1…
How to check certificate validity in Linux?
This article help you to check certificate expiry date from Linux command line using openssl utility. Check SSL certificate expiration date Syntax: openssl x509 -enddate -noout -in <certificate name> openssl x509 -enddate -noout -in openssl x509 -enddate -noout -in
[Warning] IPv4 forwarding is disabled. Networking will not work
IPv4 forwarding is disabled WARNING I was facing this issue while creating a Docker image in Centos 7. Error: ---> IPv4 forwarding is disabled. Networking will not work. Solution: Add in / Restart network service $ systemctl restart network.
Could not resolve host: mirrorlist.centos.org Centos 7
I have installed Centos 7 in Vmware WorkStation. I tried to install few new packages using yum install. However, I was getting error "Could not resolve host: Centos 7" [root@localhost ~]# yum install dos2unix Loaded plugins: fastestmirror Could not retrieve mirrorlist ;arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve…
ASCII Table – ASCII Character Codes
What is the ASCII Code? ASCII (ASS-kee) abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Most modern character-encoding schemes are based on ASCII, although they support many additional characters. More details…
How to Split String with a Delimiter in Shell Script
Split String with a Delimiter in Shell Script You can use Internal Field Separator (IFS) variable in shell script to split string into array. When we set IFS variable then the assignment to IFS only takes place to that single command's environment to read. It then parses the input according…
How to validate date format in shell script
How to validate date format in shell script There are multiple ways you can validate date format in shell script. You can compare date format with regular expression or you can use inbuilt date command to check given date format is valid or not. I am sharing a simple date…
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 start=$1 end=$2 start=$(date -d $start +%Y%m%d) end=$(date -d $end +%Y%m%d) while ] do echo $start start=$(date -d"$start + 1 day"…
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. The first argument would start date and the second argument as end date. To validate missing argument we can also…
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 to define multi line string variable in shell. Method 1: Combine Multiline with \n like below and echo with -e…




