Skip to content

Instantly share code, notes, and snippets.

@178inaba
Created May 16, 2015 16:36
Show Gist options
  • Save 178inaba/246bd78005b78cc453b5 to your computer and use it in GitHub Desktop.
Save 178inaba/246bd78005b78cc453b5 to your computer and use it in GitHub Desktop.
角括弧2個([[ 条件式 ]])の条件式でAND条件「-a」が使えない件(回避方法あり) ref: http://qiita.com/inaba178/items/b02662c3645595659156
$ [[ 11 -eq 11 -a "bb" = "bb" ]]; echo $?
-bash: syntax error in conditional expression
-bash: syntax error near `-a'
$ [[ 11 -eq 11 && "bb" = "bb" ]]; echo $?
0
$ [[ 11 -eq 11 -o "bb" = "ab" ]]; echo $?
-bash: syntax error in conditional expression
-bash: syntax error near `-o'
$ [[ 11 -eq 11 || "bb" = "ab" ]]; echo $?
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment