如果没有安装在 bash 脚本中,我正在尝试安装 composer 包。但是现在不行了,no_package函数总是通过
#!/bin/bash -e
no_package() {
composer show | grep matchish/laravel-scout-elasticsearch | test
}
if [ no_package ]; then
composer require "matchish/laravel-scout-elasticsearch"
else
echo 'Package installed'
fi
UPD:这是解决方案
package_installed() {
composer show | grep matchish/laravel-scout-elasticsearch --quiet
}
if package_installed; then
echo 'Package installed'
else
composer require "matchish/laravel-scout-elasticsearch"
fi
杨魅力
拉风的咖菲猫