Bash file to detect chrome installation

bashgoogle-chrome

I need to create a bash file that executes google chrome (if installed) with some flags and an input file. Does someone know how to detect chrome installation and path via a bash file?

Best Answer

This will check if Chrome is installed in the default location, then open a file at a path with arguments you have set.

CHROMEPATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
if [ -x "$CHROMEPATH" ]; then
    "$CHROMEPATH" file:///path/to/file --yourargs
fi