Reputation: 43558
I have a kind of the following strings
str1="aaa.bbb."
and
str2="aaa.ccc"
I wan to call:
echo ${str1%.*}
echo ${str2%.*}
in order to get
"aaa.bbb."
for str1
and "aaa."
for str2
what should I use as expression inside {}
Upvotes: 1
Views: 53
Reputation: 785761
Use it like this:
echo "${str1%.*}."
aaa.bbb.
echo "${str2%.*}."
aaa.
Upvotes: 1