华为机试URL拼接

2021-04-02 23:27

阅读:661

标签:url   sbin   $1   华为   fun   lse   usr   echo   拼接   

#!/bin/bash

PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin
m=$1
n=$2
function pinjie(){
if [[ $m =~ ^(.*)/$ && $n =~ ^/(.*)$ ]];then
q=${m%/}
echo "${q}${n}"
elif [[ $m =~ ^(.*)/$ && $n =~ ^[^/](.*)$ ]] || [[ $n =~ ^/(.*)$ && $m =~ ^(.*)[^/]$ ]];then
echo "${m}${n}"
elif [[ $m =~ ^(.*)[^/]$ && $n =~ ^[^/](.*)$ ]];then
echo "${m}/${n}"
else
echo "/"
fi
}

if [ ${#m} -lt 100 ] && [ ${#n} -lt 100 ];then
pinjie
else
exit 1
fi

华为机试URL拼接

标签:url   sbin   $1   华为   fun   lse   usr   echo   拼接   

原文地址:https://www.cnblogs.com/hrers/p/12546029.html


评论


亲,登录后才可以留言!