diff --git a/url.shortme.sh b/url.shortme.sh index da30115..df501b1 100755 --- a/url.shortme.sh +++ b/url.shortme.sh @@ -52,6 +52,13 @@ fi [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG − Get URL : URL to be shortened : ${url_to_short}" # ]]] +# Ensure the URL wasn't already shortened [[[ +if printf -- '%s' "${url_to_short}" | grep -q -E -- "${null_service_url}" +then + printf "${c_redb}%b${c_reset}\n" "Error : The url to be shortened (${url_to_short}) already seems to comes from the 0x0 service (${null_service_url})." + exit 1 +fi +# ]]] # shorten URL result=$(curl -sF"shorten=${url_to_short}" "${null_service_url}")