if we are using [[ we should not be using sh as it is not POSIX
replace backtick command sub with $()