Created
September 23, 2019 22:01
-
-
Save ntilwalli/c2a412a2b4e1d41078a54d6844f32a25 to your computer and use it in GitHub Desktop.
Bash script to extract chromedriver version based on installed google-chrome-stable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extract_chromedriver_version(){ | |
local regex='Google Chrome ([0-9]{1,4}.[0-9]{1,4}.[0-9]{1,4}).[0-9]*' | |
local mystring1=$(google-chrome-stable --version) | |
[[ $mystring1 =~ $regex ]] | |
local base_ver=${BASH_REMATCH[1]} | |
local filename="LATEST_RELEASE_${base_ver}" | |
local url="https://chromedriver.storage.googleapis.com/${filename}" | |
wget ${url} | |
local chromedriver_version=$(cat ${filename}) | |
rm ${filename} | |
echo ${chromedriver_version} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment