CCCPaste

Bash function to remove slash from end of string

################################################################################
# Function:     chomp_slash
# Description:  Removes any trailing slash ("/") from a string
# Arguments:    $1 :- String from which to remove any trailing slashes
# Ouputs:       Prints string with trailing slashes removed
function chomp_slash {
    local dir="$1"
    while [ "${dir:(-1)}" = '/' ]; do
        dir=${dir::-1}
    done
    echo "${dir}"
}