[Groonga-commit] droonga/droonga-engine at c90c92b [master] Simplify

Back to archive index

Kouhei Sutou kou****@clear*****
Tue Sep 16 12:38:12 JST 2014


> +[ "$VERSION" = "" ] && VERSION="release"
> +[ "$HOST" = "" ] && HOST="Auto Detect"

短くしたいなら

  : ${HOST:=Auto Detect}

みたいに書けますよ。

「:」が何もしないコマンドで、
${VARIABLE_NAME:=DEFAULT_VALUE}が、$VARIABLE_NAMEの値が空な
らDEFAULT_VALUEを代入する変数展開の書き方です。

In <c90c92b741aef9f32cdd3181ccb4ade1b600008b �� jenkins.clear-code.com>
  "[Groonga-commit] droonga/droonga-engine �� c90c92b [master] Simplify" on Tue, 16 Sep 2014 12:23:41 +0900,
  YUKI Hiroshi <null+groonga �� clear-code.com> wrote:

> YUKI Hiroshi	2014-09-16 12:23:41 +0900 (Tue, 16 Sep 2014)
> 
>   New Revision: c90c92b741aef9f32cdd3181ccb4ade1b600008b
>   https://github.com/droonga/droonga-engine/commit/c90c92b741aef9f32cdd3181ccb4ade1b600008b
> 
>   Message:
>     Simplify
> 
>   Modified files:
>     install.sh
> 
>   Modified: install.sh (+2 -7)
> ===================================================================
> --- install.sh    2014-09-16 12:22:54 +0900 (7ffce3a)
> +++ install.sh    2014-09-16 12:23:41 +0900 (4a4e7c3)
> @@ -25,13 +25,8 @@ REPOSITORY_URL=https://github.com/droonga/$NAME.git
>  USER=$NAME
>  DROONGA_BASE_DIR=/home/$USER/droonga
>  
> -if [ "$VERSION" = "" ]; then
> -  VERSION=release
> -fi
> -
> -if [ "$HOST" = "" ]; then
> -  HOST="Auto Detect"
> -fi
> +[ "$VERSION" = "" ] && VERSION="release"
> +[ "$HOST" = "" ] && HOST="Auto Detect"
>  
>  case $(uname) in
>    Darwin|*BSD|CYGWIN*) sed="sed -E" ;;




More information about the Groonga-commit mailing list
Back to archive index