配置SSL证书的时候遇到一个问题,certbot
有时候会在证书的名字后面多加一个数字,需要使用shell去除,这里使用正则表达式的子匹配功能,选出第一个匹配的区域,在其他场景下可以根据需要更改BASH_REMATCH[]
的值以截取需要的部分。
1 | if [[ $file =~ ^(.+)+[0-9].pem ]] ; then |
该内容采用 CC BY-NC-ND 4.0 许可协议,著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
配置SSL证书的时候遇到一个问题,certbot
有时候会在证书的名字后面多加一个数字,需要使用shell去除,这里使用正则表达式的子匹配功能,选出第一个匹配的区域,在其他场景下可以根据需要更改BASH_REMATCH[]
的值以截取需要的部分。
1 | if [[ $file =~ ^(.+)+[0-9].pem ]] ; then |
该内容采用 CC BY-NC-ND 4.0 许可协议,著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。