2
2

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-06-04

シェルスクリプトを書き始めて間もない初心者の私のために記事を書きました。特別な変数をまとめて記述します。

他の初学の方で参考になればとおもいます。

$0~9:位置パラメータ
$#:引数の個数
$@:引数全体の参照 ex. "$@"="$1" "$2" "$3"・・"$n"
$*:引数全体の参照 ex. "$*"="$1 $2 $3 ・・$n"
$?:直前に実行したコマンドの終了値
$$:シェルスクリプトのプロセスID
$!:最後に実行したバックグラウンドプロセスID

${@:-.}:引数があれば$@を使い、なければ.(カレントディレクトリー)を使う

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?