AWS Setup for Bash

Refer:  https://www.crmarsh.com/aws/

To have your account use bash, you need to update your account:

$ sudo vi /etc/passwd

You will need at the end - ::/home/mruckman:/bin/bash

This is both your home directory and also the :/bin/bash says to use bash

Loop script example

Refer: https://www.cyberciti.biz/faq/bash-for-loop/

for i in `find . -name '*.xml'`
do
   echo $i
done

This type of for loop is characterized by counting. The range is specified by a beginning (#1) and ending number (#5). The for loop executes a sequence of commands for each member in a list of items. A representative example in BASH is as follows to display welcome message 5 times with for loop:

#!/bin/bash
for i in 1 2 3 4 5
do
   echo "Welcome $i times"
done

Sometimes you may need to set a step value (allowing one to count by two’s or to count backwards for instance). Latest bash version 3.0+ has inbuilt support for setting up ranges:

#!/bin/bash
for i in {1..5}
do
   echo "Welcome $i times"
done

Bash v4.0+ has inbuilt support for setting up a step value using {START..END..INCREMENT} syntax:

#!/bin/bash
echo "Bash version ${BASH_VERSION}..."
for i in {0..10..2}
do
  echo "Welcome $i times"
done

Compare Folders

Use the diff command with the -q switch for simple output, such as:
diff -q folder1 folder2 | sort > compare.txt