From 893f4459b619326f380bb8950a3457bb470db353 Mon Sep 17 00:00:00 2001 From: Igor Shubovych Date: Sun, 13 Dec 2015 00:08:54 +0200 Subject: [PATCH] test: add page --- pages/common/test.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pages/common/test.md diff --git a/pages/common/test.md b/pages/common/test.md new file mode 100644 index 0000000000..26ccfd8860 --- /dev/null +++ b/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"`