Recently one of my bash scripts failed because cmake
and zip
/ unzip
were not installed on a system.
What would be a convenient way to check for installed packages in $PATH
env?
I would like to check $PATH
directly for cmake
and the like since my script is running on Debian, Ubuntu, Arch, and so on. Thus, I would prefer to not use a package manager, because I would have to implement it several times using dpkg
, pacman
, ... based on the distribution the script is currently executed on.
cmake
andzip
then those are installed by the package manager and the binaries will be in/usr/bin
unless you built them from source and put them elsewhere. If you installed them via the package manager then you can just use the package tool likerpm
ordpkg-query
to search for the installed packages. – Nasir Riley Mar 09 '19 at 23:47rpm
,dpkg
,pacman
, ... It is quite cumbersome to maintain this by hand so I would prefer to not use different package managers. – daniel451 Mar 10 '19 at 00:11