简体   繁体   English

这个正则表达式在 Entrypoint.sh 中做了什么?

[英]What is this Regex doing inside the Entrypoint.sh?

Can someone tell me what this line means?谁能告诉我这条线是什么意思?

Entrypoint.sh:入口点.sh:

export NAME="$(sed -e 's/^"//' -e 's/"$//' <<<"$NAME")"

All I know is that its performing regex to the variable $NAME but I dont know what exactly its doing.我所知道的是它对变量 $NAME 执行正则表达式,但我不知道它到底在做什么。 I've tried using RegExr.com but it tells me that the expression is wrong.我试过使用 RegExr.com 但它告诉我表达式是错误的。

It removes any starting and ending quotes.它删除任何开始和结束的引号。 It is using 2 regexes: s/^"// and s/"$// .它使用 2 个正则表达式: s/^"//s/"$// First one substitutes a starting quote with nothing and the latter substitutes an ending quote with nothing.第一个用空替换起始引号,后者用空替换结束引号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM