-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathshellscript.json
97 lines (97 loc) · 3.16 KB
/
shellscript.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
"bash": {
"prefix": [
"bash",
"#!",
"shebang"
],
"body": "${1|#!/bin/bash,#!/usr/bin/env bash|}\n",
"description": [
"Option 1:\n",
"#!/bin/bash\n",
"Description: Shebang Bash executor.\n",
"Option 2:\n",
"#!/usr/bin/env bash\n",
"Description: Shell searchs for the first match of bash in the $PATH environment variable.\n",
"It can be useful if you aren't aware of the absolute path or don't want to search for it.\n"
]
},
"echo": {
"prefix": "echo",
"body": "echo \"${0:message}\"",
"description": "Echo a message."
},
"read": {
"prefix": "read",
"body": "read -r ${0:VAR}",
"description": "Read input of ${VAR}."
},
"if": {
"prefix": "if",
"body": "if [[ ${0:condition} ]]; then\n\t${1}\nfi",
"description": "An IF statement."
},
"elseif": {
"prefix": "elseif",
"body": "elif [[ ${0:condition} ]]; then\n\t${1}",
"description": "Add an elseif to an if statement."
},
"else": {
"prefix": "else",
"body": "else\n\t${0:command}",
"description": "else"
},
"for_in": {
"prefix": "for_in",
"body": "for ${0:VAR} in $${1:LIST}\ndo\n\techo \"$${0:VAR}\"\ndone\n",
"description": "for loop in list"
},
"for_i": {
"prefix": "for_i",
"body": "for ((${0:i} = 0; ${0:i} < ${1:10}; ${0:i}++)); do\n\techo \"$${0:i}\"\ndone\n",
"description": "An index-based iteration for loop."
},
"while": {
"prefix": "while",
"body": "while [[ ${1:condition} ]]; do\n\t${0}\ndone\n",
"description": "A while loop by condition."
},
"until": {
"prefix": "until",
"body": "until [[ ${1:condition} ]]; do\n\t${0}\ndone\n",
"description": "until loop by condition"
},
"function": {
"prefix": "function",
"body": "${1:name} ()\n{\n\t${0}\n}",
"description": [
"This defines a function named name.\n",
"The reserved word function is optional.\n",
"If the function reserved word is supplied, the parentheses are optional.\n",
"1. Recommended way:\n",
"name() {}\n",
"2. C-like-way:\nfunction name [()] {}"
]
},
"case": {
"prefix": "case",
"body": "case \"$${0:VAR}\" in\n\t${1:1}) echo 1\n\t;;\n\t${2:2|3}) echo 2 or 3\n\t;;\n\t*) echo default\n\t;;\nesac\n",
"description": [
"case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac\n",
"A case command first expands word, and tries to match it against each pattern in turn."
]
},
"break": {
"prefix": "break",
"body": "break ${0}",
"description": [
"The break command tells Bash to leave the loop straight away.\n",
"Enter the break or break (n) where n=number of loops."
]
},
"expr": {
"prefix": "expr",
"body": "expr ${0:1 + 1}",
"description": "Calculate numbers with Bash."
}
}