[Mac]Automator等のシェルスクリプトでタイムアウトさせるgtimeout


![「[Mac]Automator等のシェルスクリプトでタイムアウトさせるgtimeout」のアイキャッチ画像](/images/tmb/mac-gtimeout.jpg)

Automatorでシェルスクリプトをタイムアウトさせたくて、調べてみたらHomebrewでパッケージを追加する必要があったのでメモ。

{{}}

## Coreutilsを追加して、gtimeout

### [Homebrew](https://brew.sh/index_ja) インストール (一応

“`shell
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”
“`

### Coreutils インストール

“`sh
brew install coreutils
“`

### 使い方

“`shell
gtimeout 秒数 コマンド
“`

***

しっかり10秒で止まってる。

“`shell
gtimeout 10 ping google.com
“`

![](/images/mac-gtimeout-1.jpg)


コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です