Category: BASH Shell
We can compute the Greatest Common Divisor (GCD) using Iterative Divide/Remainder Method. The following is the GCD implementation in BASH Programming: #!/bin/bash function gcd() { local x=$1 local y=$2 …
Based on the calc function defined in BASH via AWK, we can perform floating point computation in BASH. The $RANDOM variable gives a psuedo random integer that is within …
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 …
If you connect to a SSH – when the window is closed, all running programs in the current session will be terminated. One way to solve this is to …
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 …