Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一种以下字符串
str1="aaa.bbb."
和
str2="aaa.ccc"
我想打电话:
echo ${str1%.*} echo ${str2%.*}
为了得到
"aaa.bbb."为了str1
"aaa.bbb."
str1
并且"aaa."对于str2
"aaa."
str2
我应该用什么作为里面的表达{}
{}
像这样使用它:
echo "${str1%.*}." aaa.bbb. echo "${str2%.*}." aaa.