Hi I'm try to do an installer which is compatible among different linux distros. It is possible to achieve something like this (see the last line of code).
PACKAGE_MANAGER=$1
INSTALL_PACKAGE_CMD=""
# CHECK PACKAGE MANAGER
if [ "$s1" == apt ]
then INSTALL_PACKAGE_CMD="apt install -y" fi
if [ "$s1" == pacman ]
then INSTALL_PACKAGE_CMD="pacman --noconfirm --force" fi
# INSTALL PACKAGE
# (using the selected package manager)
sudo $INSTALL_PACKAGE_CMD sqlite
Unlike in C, the line endings are not ignored by bash. Try this: