#!/bin/sh
re="\/$"
if [ $1 =~ $re ]; then
echo "${ATTENTION_PREFIX}$1 DIRECTORY MAY NOT CONTAIN A \"/\" OR LITERAL SLASH!${ATTENTION_POSTFIX}"
exit 1
fi
Executing sudo ./file.sh hello/ results in [: 29: hello: unexpected operator
It looks like that this regular expression method is incorrect for shell scripting.