Created
March 23, 2017 13:53
-
-
Save Amakata/5e3f01306d2692468d54e4e9a7805b61 to your computer and use it in GitHub Desktop.
shのお勉強
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# コマンドでエラーが返ってきた時点で停止 | |
set -e | |
# 1つめの引数に-が含まれている場合 ${variable#pattern}で、variableの値の最初の部分とpatternが一致した場合に、最も短く一致した部分を削除して、残りを返す。 | |
if [ "${1#-}" != "$1" ]; then | |
# set -- a b は、 --の後のパラメータを$1,$2,...に格納し直す | |
# "$@"は、$1 $2 $3 ... を "$1" "$2" "$3" という感じの形式に変換する | |
set -- php "$@" | |
fi | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
${variable#pattern}は、bashのパターンとパターン照合、パターン照合演算子等のキーワードで調べられる