bash - 如何使用命令行检查是否安装了 c-blosc?

标签 bash command-line homebrew

使用 command -v c-blosc即使已安装,也不返回任何内容
c-blosc 将自己描述为 compression library ,所以这不是命令

我尝试过的一些事情

% c-blosc
zsh: command not found: c-blosc
where c-blosc
c-blosc not found
brew install c-blosc
...
Warning: c-blosc 1.21.0 is already installed and up-to-date.
To reinstall 1.21.0, run:
  brew reinstall c-blosc

% brew info c-blosc
c-blosc: stable 1.21.0 (bottled)
Blocking, shuffling and loss-less compression library
https://blosc.org/
/usr/local/Cellar/c-blosc/1.21.0 (10 files, 1.7MB) *
  Poured from bottle on 2021-07-07 at 23:44:40
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/c-blosc.rb
License: BSD-3-Clause
==> Dependencies
Build: cmake ✘
==> Analytics
install: 312 (30 days), 1,190 (90 days), 3,168 (365 days)
install-on-request: 249 (30 days), 998 (90 days), 2,263 (365 days)
build-error: 0 (30 days)
brew search c-blosc 
==> Formulae
c-blosc ✔

下列
if [ brew info c-blosc 2>&1 >/dev/null ]; then
    echo "Installed"
else
    echo "Nope"
fi
if [ brew search c-blosc 2>&1 >/dev/null ]; then
    echo "Installed"
else
    echo "Nope"
fi
都打印 Nope即使我安装了它

最佳答案

根据 https://apple.stackexchange.com/q/145437 ,你可以这样做

brew info c-blosc
除其他外,这将打印安装位置。
您可以使用相关命令,如 search :
brew search c-blosc
唯一明确的命令 documented为缺少的公式返回失败代码是
brew --prefix --installed c-blosc
它没有专门的输出,所以你可以做
if brew --prefix --installed c-blosc 2>/dev/null; then
    echo "Installed"
else
    echo "Nope"
fi

关于bash - 如何使用命令行检查是否安装了 c-blosc?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68333411/

相关文章:

bash - shell脚本中的 `kill -0 $pid`有什么作用?

java - 从 java 编写 bash 脚本

mysql - brew install mysql 在 mountain lion 上遵循这个 SO 失败

homebrew - 如何在 OSX 上安装 apg(密码生成器)?

linux - 知道文件夹中的最后一个文件是否早于 1 小时

bash - 在一组文件中查找文本的更简洁的方法是什么?

java - 命令行编程

python - python 3 中缺少 argparse

command-line - 安装oAuth PECL错误: Cannot install, php_dir for channel "pecl.php.net"is not writeable by current user

mysql2 gem 无法在 OS X 上使用 Homebrew 编译 MySQL 5.6.12