fix(posix-shell): fix on checking command exist

Use `command -v $CMD >/dev/null 2>&1` to check if command exist
This commit is contained in:
js0ny 2025-02-23 20:31:13 +00:00
parent 8aa9daf582
commit f3333d2292
7 changed files with 470 additions and 479 deletions

View file

@ -1,7 +1,8 @@
echo "[INFO] Installing AppMan"
echo "[ACTION] Type [2] to install AppMan"
wget -q https://raw.githubusercontent.com/ivan-hc/AM/main/AM-INSTALLER && chmod a+x ./AM-INSTALLER && ./AM-INSTALLER
if [ command -v appman ]; then
if command -v appman >/dev/null 2>&1; then
appman install wezterm
appman install nvim
fi

View file

@ -44,10 +44,10 @@ export GUI_SETUP
if [ "$WHEEL" -eq 1 ]; then
echo "[INFO] Installing basic build tools"
if [ command -v apt ]; then
if command -v apt >/dev/null 2>&1; then
sudo apt update
sudo apt install -y build-essential
elif [ command -v pacman ]; then
elif command -v pacman >/dev/null 2>&1; then
sudo pacman -Syu --noconfirm
sudo pacman -S --noconfirm base-devel
else
@ -60,7 +60,7 @@ echo "[INFO] Cloning Dotfiles"
if [ -d "$DOTFILES" ]; then
echo "[INFO] Dotfiles already cloned"
elif [ command -v git ]; then
elif command -v git >/dev/null 2>&1; then
git clone https://github.com/js0ny/dotfiles.git "$DOTFILES" --depth 1
else
echo "[ERROR] Git is not installed"
@ -92,7 +92,8 @@ source $DOTFILES/tools/bash/profile
source $DOTFILES/tools/bash/bashrc
source $DOTFILES/tools/bash/bash_aliases
if [ command -v zsh ]; then
if command -v zsh >/dev/null 2>&1; then
read -p "[ACTION] Do you want to setup zsh? (Y/n) " choice
case "$choice" in
n|N)