# check current Bash version
bash -version
# output:
# GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)
get_person_details() {
local name="John"
local age=25
# Return the values
echo "$name $age"
}
# Extract the values from the func
#!/usr/bin/env bash
set -euo pipefail
declare -A hash_set
# Add elements to the hash set
hash_set["name1"]="Matthew"
hash_set["name2"]="Luke"
usr/bin/env bash
set -euo pipefail
check_bash_version() {
if [[ ${BASH_VERSINFO[0]} -lt 5 ]]; then
echo "Error: At least Bash version 5 is required."
echo "Your Bash version is: ${BASH_VERSINFO[0]}"
exit 1
OlderNewer