<commit_before>#!/bin/bash
# <NAME> <<EMAIL>>
# Template for bash scripts.

# echo "# arguments called with ---->  ${@}     "
# echo "# \$1 ---------------------->  $1       "
# echo "# \$2 ---------------------->  $2       "
# echo "# path to me --------------->  ${0}     "
# echo "# parent path -------------->  ${0%/*}  "
# echo "# my name ------------------>  ${0##*/} "
# cite [1]

DEPENDENCIES=( one two three )

function usage()
{
	# echo usage of script.
	exit 0
}

function check_dependencies()
{
	pass=true
	for d in "${DEPENDENCIES[@]}"; do
	    hash "$d" &>/dev/null 
    	if [ $? != 0 ]; then
    		echo "[ ! ] $d required"
    		pass=false
    	fi
	done 

	if [ $pass == false ]; then
		echo '[ ! ] unmet dependencies, aborting. '
		exit -1
	fi
}

function argparse()
{
	while getopts "h?" opt; do
		case "$opt" in
			h|\?) usage "$@" ;;
		esac
	done
}

function require_root()
{
	if [ "$UID" -ne "0" ] ; then
		echo "[ ! ] script requires root, aborting."
		exit -1
	fi
}

function action()
{
	echo "hello world."
}

function main()
{
	argparse "$@"
	action   "$@"	
}
main "$@"

# Side notes:<commit_msg>User of EUID is more proper than UID for root permission check.<commit_after>#!/bin/bash
# <NAME> <<EMAIL>>
# Template for bash scripts.

# echo "# arguments called with ---->  ${@}     "
# echo "# \$1 ---------------------->  $1       "
# echo "# \$2 ---------------------->  $2       "
# echo "# path to me --------------->  ${0}     "
# echo "# parent path -------------->  ${0%/*}  "
# echo "# my name ------------------>  ${0##*/} "
# cite [1]

DEPENDENCIES=( one two three )

function usage()
{
	# echo usage of script.
	exit 0
}

function check_dependencies()
{
	pass=true
	for d in "${DEPENDENCIES[@]}"; do
	    hash "$d" &>/dev/null 
    	if [ $? != 0 ]; then
    		echo "[ ! ] $d required"
    		pass=false
    	fi
	done 

	if [ $pass == false ]; then
		echo '[ ! ] unmet dependencies, aborting. '
		exit -1
	fi
}

function argparse()
{
	while getopts "h?" opt; do
		case "$opt" in
			h|\?) usage "$@" ;;
		esac
	done
}

function require_root()
{
	if [ "$EUID" -ne "0" ] ; then
		echo "[ ! ] script requires root, aborting."
		exit -1
	fi
}

function action()
{
	echo "hello world."
}

function main()
{
	argparse "$@"
	action   "$@"	
}
main "$@"

# Side notes:
{'fraction_non_alphanumeric': 0.25796595373199477, 'fraction_numerical': 0.011348756001745963, 'mean_word_length': 1.8685857321652064, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2928700', 'n_tokens_mistral': 871, 'n_tokens_neox': 818, 'n_words': 242}