「Linux/コマンドメモ/bash」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「 ==シェルスクリプト実行== スクリプトのあるDirまでcdでいき $ ./xxx.sh とする。 ○シェルは実行権限がいる #!/bin/bash ProcessCount...」) |
(→シェルスクリプト実行) |
||
| 行17: | 行17: | ||
実行できなければ、bashをつける | 実行できなければ、bashをつける | ||
bash xxx.sh | bash xxx.sh | ||
| + | |||
| + | ==bash実行時に環境変数を読み込む== | ||
| + | $ vi test.sh | ||
| + | #!/bin/bash | ||
| + | echo $ANDROID_HOME | ||
| + | $ test.sh | ||
| + | /Users/hogehoge/Library/Android/sdk | ||
2018年11月28日 (水) 15:08時点における版
シェルスクリプト実行
スクリプトのあるDirまでcdでいき
$ ./xxx.sh
とする。
○シェルは実行権限がいる
#!/bin/bash
ProcessCount=`ps -e|grep -e 'xxx.sh' -c`
if [ $ProcessCount -gt 2 ] ; then
exit 1
fi
cd /export1/batch/batDir/
/usr/local/bin/php bat1.php
/usr/local/bin/php bat2.php
実行できなければ、bashをつける
bash xxx.sh
bash実行時に環境変数を読み込む
$ vi test.sh #!/bin/bash echo $ANDROID_HOME $ test.sh /Users/hogehoge/Library/Android/sdk
