标签: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 sbin $1 华为 fun lse usr echo 拼接
原文地址:https://www.cnblogs.com/hrers/p/12546029.html