0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

複数コマンドの実行

Last updated at Posted at 2019-11-21

選択実行(ANDとOR)

1つのコマンド実行単位が成功したときに後続する文を実行するときは、&&で文を実行する。
最初の文の実行が失敗した時のみ後続する文を実行するときは||で文を接続する。


$command1 && command2  #1が成功した時のみ2が実行される。
$command1 || command2  #1が失敗した時のみ2が実行される。

また、3つ以上繋げられているとき、&&と||に優先順位はなく、左から順に評価される。ただ、()でくくったらそれが先に評価される。

連続実行

最初の文の実行終了後(その終了値に関わらず)、次の文を実行するには;で文を接続する。

バックグラウンド実行

文末に&をつけて実行した文はバックグランド実行される。

参考文献

  • 『zshの本』p302~
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?