Browse Source

Merge pull request #357 from igorshubovych/test

test: add page
Felix Yan 9 years ago
parent
commit
84c012a362
1 changed files with 24 additions and 0 deletions
  1. 24 0
      pages/common/test.md

+ 24 - 0
pages/common/test.md

@@ -0,0 +1,24 @@
+# test
+
+> Evaluate condition.
+> If it is true, returns 0 exit status, otherwise returns 1.
+
+- Test if given variable is equal to given string
+
+`test $MY_VAR == '/bin/zsh'`
+
+- Test if given variable is empty
+
+`test -z $GIT_BRANCH`
+
+- Test if file exists
+
+`test -e {{filename}}`
+
+- Test if directory not exists
+
+`test ! -d {{path/to/directory}}`
+
+- If-else statement
+
+`test {{condition}} && echo "true" || echo "false"`