Skip to content

Instantly share code, notes, and snippets.

@ntilwalli
Created September 23, 2019 22:01
Show Gist options
  • Save ntilwalli/c2a412a2b4e1d41078a54d6844f32a25 to your computer and use it in GitHub Desktop.
Save ntilwalli/c2a412a2b4e1d41078a54d6844f32a25 to your computer and use it in GitHub Desktop.
Bash script to extract chromedriver version based on installed google-chrome-stable
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