You can test if a command exists in several ways, but the most portable one should be using command -v which is POSIX.
if command -v playerctl &> /dev/null
# do things
else
# warn and exit (or prompt for installation)
end
You can test if a command exists in several ways, but the most portable one should be using command -v which is POSIX.
if command -v playerctl &> /dev/null
# do things
else
# warn and exit (or prompt for installation)
end