I have this variable:
A="Some variable has value abc.123"
I need to extract this value i.e abc.123. Is this possible i
The documentation is a bit painful to read, so I've summarised it in a simpler way.
Note that the '*' needs to swap places with the '' depending on whether you use # or %. (The * is just a wildcard, so you may need to take off your "regex hat" while reading.)
${A%% *} - remove longest trailing * (keep only the first word)${A% *} - remove shortest trailing * (keep all but the last word)${A##* } - remove longest leading * (keep only the last word)${A#* } - remove shortest leading * (keep all but the first word)Of course a "word" here may contain any character that isn't a literal space.