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

シェルスクリプトに環境変数を渡して表示する方法

Last updated at Posted at 2015-12-03

シェルファイルを作る。

color.sh
#!/bin/sh

echo $COLOR

コマンドラインでシェルを実行する。
このとき、 COLOR=green の環境変数を渡す。

$ COLOR=green sh test.sh

green が表示される。

green

  • 散々各所で書かれてきたことだと思うが、メモ。

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

メンター受付

4
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
4
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?