X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/0e1bef1674d633af4a75f32d7c7ccd68c5fe2524..508c8c87a840e8d6040ae2c1b2b2f9b2ed408fcc:/unitproc/bktemp-checkURL diff --git a/unitproc/bktemp-checkURL b/unitproc/bktemp-checkURL index 81f934d..6ae6ff0 100644 --- a/unitproc/bktemp-checkURL +++ b/unitproc/bktemp-checkURL @@ -3,18 +3,18 @@ checkURL() { # Desc: Checks if string is a valid URL. # Warning: Does not correctly handle multi-byte characters. - # Version: 0.0.1 + # Version: 0.0.2 # Input: arg1: string # Output: return code 0: string is a valid URL # return code 1: string is NOT a valid URL # Depends: Bash 5.0.3 # Ref/Attrib: https://stackoverflow.com/a/3184819 regex='(https?|ftp|file|ssh|git)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' - string="$1"; - if [[ $1 =~ $regex ]]; then + arg1="$1"; + if [[ $arg1 =~ $regex ]]; then return 0; else - reutrn 1; + return 1; fi; }