From 1df8f4cec99b72ffbf6c56536f4a563a6b0d260b Mon Sep 17 00:00:00 2001 From: Remisa Yousefvand Date: Fri, 21 Dec 2018 00:34:30 +0330 Subject: [PATCH] v4.1.1 --- CHANGELOG.md | 5 +++++ COMMANDS.md | 16 +++++++++++++--- README.md | 5 +++++ package-lock.json | 2 +- package.json | 2 +- snippets/snippets.json | 11 ++++++++--- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca86b24..56b534d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 4.1.1 + +- Minor bugs fixed. +- `let` added for arithmetic operations. + ## 4.0.0 - fixed issues [3](https://github.com/remisa-yousefvand/shellman/issues/3), [4](https://github.com/remisa-yousefvand/shellman/issues/4), [5](https://github.com/remisa-yousefvand/shellman/issues/5), [6](https://github.com/remisa-yousefvand/shellman/issues/6), [7](https://github.com/remisa-yousefvand/shellman/issues/7) diff --git a/COMMANDS.md b/COMMANDS.md index 13132bd..381cb1e 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -252,6 +252,8 @@ - [switch case](#switch-case) +- [let](#let) + - [expr](#expr) - [math ++](#math-++) @@ -1241,7 +1243,7 @@ temp=${string%%"substring"*} && indexOf=`echo ${string%%"substring"*} | echo ${# if integers are equal [↑](#Commands) ```bash -if (( int1 = ${2:int2} )); then +if (( int1 == ${2:int2} )); then echo equal fi ``` @@ -1311,7 +1313,7 @@ fi if path exists (file, directory, link...) [↑](#Commands) ```bash -if [ -e "$path"; then +if [ -e "$path" ]; then echo exists fi ``` @@ -1521,12 +1523,20 @@ case "$item" in esac ``` +## `let` + +arithmetic operations [↑](#Commands) + +```bash +let "result = var1 ${3|+,-,*,/,%|} var2" +``` + ## `expr` arithmetic operations [↑](#Commands) ```bash -expr 2 * 3 +expr 2 ${2|+,-,\*,/,%|} 3 ``` ## `math ++` diff --git a/README.md b/README.md index 3c41297..dbffcf4 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,11 @@ Call function which is declared by `fn...` ## Release Notes +### 4.1.1 + +- Minor bugs fixed. +- `let` added for arithmetic operations. + ### 4.0.0 - fixed issues [3](https://github.com/remisa-yousefvand/shellman/issues/3), [4](https://github.com/remisa-yousefvand/shellman/issues/4), [5](https://github.com/remisa-yousefvand/shellman/issues/5), [6](https://github.com/remisa-yousefvand/shellman/issues/6), [7](https://github.com/remisa-yousefvand/shellman/issues/7) diff --git a/package-lock.json b/package-lock.json index 0f969ba..0daaa26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "shellman", - "version": "4.0.0", + "version": "4.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8ea2e59..4b7549b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "shellman", "displayName": "shellman", "description": "Bash script snippet", - "version": "4.0.0", + "version": "4.1.1", "publisher": "Remisa", "icon": "images/icon.png", "license": "SEE LICENSE IN LICENSE.md", diff --git a/snippets/snippets.json b/snippets/snippets.json index 45e330f..2e57cd3 100644 --- a/snippets/snippets.json +++ b/snippets/snippets.json @@ -598,7 +598,7 @@ "if_int_equal": { "prefix": "if int =", "body": [ - "if (( ${1:int1} = ${2:int2} )); then", + "if (( ${1:int1} == ${2:int2} )); then", "\t${3:echo equal}", "fi\n" ], @@ -661,7 +661,7 @@ "if_exists": { "prefix": "if exists", "body": [ - "if [ -e \"\\$${1:path}\"; then", + "if [ -e \"\\$${1:path}\" ]; then", "\t${0:echo exists}", "fi\n" ], @@ -846,9 +846,14 @@ ], "description": "switch case" }, + "let": { + "prefix": "let", + "body": "let \"${1:result} = ${2:var1} ${3|+,-,*,/,%|} ${4:var2}\"\n", + "description": "arithmetic operations" + }, "expr": { "prefix": "expr", - "body": "expr ${0:2 * 3}\n", + "body": "expr ${1:2} ${2|+,-,\\*,/,%|} ${3:3}\n", "description": "arithmetic operations" }, "math_inc": {