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 1 year has passed since last update.

Macのcommandファイル(シェルスクリプト)でターミナルを入力待ち一時停止にするには?

Last updated at Posted at 2022-08-28

概要

commandファイル(シェルスクリプト)を作っている途中で、変数の中身をちょっと確認したい。
でも echo $変数名 と書いて実行すると、ターミナルがすぐ閉じてまう。

だから、 ユーザーが入力するまでターミナルを閉じずに一時的に止めておきたい
そんな時。

やり方

read コマンド。

ターミナルを止めつつ変数の中身を確認するサンプル
test=あああああああ
echo $test
read

実行結果は下記。
エンター押すまでターミナルは閉じない。
image.png

pauseというコマンドは存在しない

image.png

バージョン

macOS Monterey バージョン12.5.1

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?