Issue
I have this string:
package: name='my.package.name versionCode='221013140' versionName='00.00.05' platformBuildVersionName='12' platformBuildVersionCode='32' compileSdkVersion='32' compileSdkVersionCodename='12'
Using bash, how can I get this value?
00.00.05
Solution
Use parameter expansion:
#!/bin/bash
string="package: name='my.package.name versionCode='221013140' versionName='00.00.05' platformBuildVersionName='12' platformBuildVersionCode='32' compileSdkVersion='32' compileSdkVersionCodename='12'"
version=${string#* versionName=\'} # Remove everything up to the version name.
version=${version%%\'*} # Remove everything after the first quote.
echo "$version"
Answered By - choroba Answer Checked By - Gilberto Lyons (WPSolving Admin)