0
1

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.

シェルスクリプトに引数を渡す方法

Posted at

引数を渡す方法

以下の内容でsample.shを作成します。

sample.sh
echo "引数: $@"

echo "引数1: $1"
echo "引数2: $2"
echo "引数3: $3"

ターミナルで次のようにコマンドを実行すると引数を渡せます。

 bash sample.sh arg1 arg2 arg3
$ bash sample.sh arg1 arg2 arg3
引数: arg1 arg2 arg3
引数1: arg1
引数2: arg2
引数3: arg3
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?