#!/usr/bin/env bash set -e encode_name() { local result="$1_" local name="$2" if [[ ! "$name" =~ [^[:alnum:]\ _-] ]]; then name="${name//_/-5f}" name="${name//-/-2d}" name="${name// /_}" result+="$name" else local length="${#name}" local char i for ((i=0; i