华为机试URL拼接
2021-04-02 23:27
标签:url sbin $1 华为 fun lse usr echo 拼接 #!/bin/bash PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin if [ ${#m} -lt 100 ] && [ ${#n} -lt 100 ];then 华为机试URL拼接 标签:url sbin $1 华为 fun lse usr echo 拼接 原文地址:https://www.cnblogs.com/hrers/p/12546029.html
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
}
pinjie
else
exit 1
fi
上一篇:HTML5(二)音频视频画布
下一篇:JS烟花案例