---
title: "シェルスクリプトでコマンドの存在を確認する"
description: "シェルスクリプトでコマンドの存在を確認する"
canonical: https://oozou.com/til/check-if-command-exists-with-shell-script-52
locale: ja
date: 2020-10-13
topic: shell
---

# シェルスクリプトでコマンドの存在を確認する

> シェルスクリプトでコマンドの存在を確認する

Published: 2020-10-13 · Topic: [shell](https://oozou.com/ja/til-topics/shell) ([markdown](https://oozou.com/ja/til-topics/shell.md))

```bash
if ! type gem > /dev/null; then
  echo 'gem command not found.'
fi
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/ja/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
