Tag: bash
sudo is the command to allow normal users perform some escalated operations. We can use the following BASH function to check to see if the sudo command is available. …
We can use the following BASH function escape to escape the parameter strings and put them one by one. For example: #!/bin/bash function escape () { for i do …
The inbuilt BASH does not support floating point arithmetic calculations but we can easily declare a function to do so via AWK. #!/bin/bash # calc.sh function calc() { awk …
June 23, 2021
algorithms, BASH, bash script, Combination, math, Permutation, programming languages, Recursion, recursive, string
Swap Two Characters in BASH In BASH, we can use “${#string}” to get the length of a string. And in a function, we use “local” keyword to declare local …
I have quite a few servers, and deploying same files/folders to them is a problem. Then I come up with the following BASH script where I can just run …