Skip to content

Commit

Permalink
ctbcap: optimize $MODEL proc
Browse files Browse the repository at this point in the history
  • Loading branch information
KFERMercer committed Jan 2, 2025
1 parent b56e268 commit 87860f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ctbcap
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ genesis_juicer() {
# Assume ${MODEL} contain some URL form, process & cut invalid chars.
local _MODEL="$(echo "${MODEL}" \
| tr '[:upper:]' '[:lower:]' \
| grep -oE 'http[s]?://[a-zA-Z]?+[.]?[a-zA-Z]+[.][a-zA-Z]+[/][^ /]+' \
| grep -oE 'http[s]?://[a-z0-9-]?+[.]?[a-z0-9-]+[.][a-z]+[/][^ /]+' \
| cut -d '/' -f4 \
| grep -oE '[a-zA-Z0-9_-]+' \
| grep -oE '[a-z0-9_-]+' \
| head -n 1)"
[ -n "${_MODEL}" ] && MODEL="${_MODEL}"
# If ${MODEL} not URL form, cut invalid chars.
[ -z "${_MODEL}" ] && local _MODEL="$(echo "${MODEL}" | tr '[:upper:]' '[:lower:]'| grep -oE '[a-zA-Z0-9_-]+' | head -n 1)"
[ -z "${_MODEL}" ] && local _MODEL="$(echo "${MODEL}" | tr '[:upper:]' '[:lower:]'| grep -oE '[a-z0-9_-]+' | head -n 1)"
[ -z "${_MODEL}" ] && {
echo "(ERROR) Invalid Username or URL! [${MODEL}]" >&2
echo >&2
Expand Down

0 comments on commit 87860f7

Please sign in to comment.