Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Use binary locations in if statements #67

Open
sveeke opened this issue Jul 6, 2019 · 0 comments
Open

Use binary locations in if statements #67

sveeke opened this issue Jul 6, 2019 · 0 comments
Assignees
Labels
improvement Improvement of existing code

Comments

@sveeke
Copy link
Contributor

sveeke commented Jul 6, 2019

Serverbot now uses something like:

if [ "$(command -v dnf)" ]; then
    ...
fi

While it might be better to just check the location of the binaries:

if [ -f "/usr/bin/dnf" ]; then
    ...
fi

Examples:
if [ -f "/usr/bin/yum" ]; then
if [ -f "/usr/bin/dnf" ]; then
if [ -f "/usr/bin/apt-get" ]; then
if [ -f "/usr/bin/apk" ]; then
if [ -f "/usr/bin/pacman" ]; then
if [ -f "/etc/init.d/sshd" ]; then
if [ -f "/etc/init.d/ssh" ]; then
if [ -f "/etc/rc.d/sshd" ]; then

@sveeke sveeke self-assigned this Jul 6, 2019
@sveeke sveeke added the improvement Improvement of existing code label Jul 6, 2019
@sveeke sveeke added this to the 1.0-RELEASE milestone Jul 7, 2019
@sveeke sveeke removed this from the 1.0-RELEASE milestone Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
improvement Improvement of existing code
Development

No branches or pull requests

1 participant