1
+ {
2
+ "shebang" : {
3
+ "description" : " [sh]hebang" ,
4
+ "prefix" : " shebang" ,
5
+ "body" : [
6
+ " #!/usr/bin/env ${1|bash,sh|}"
7
+ ]
8
+ },
9
+ "if" : {
10
+ "description" : " [if]" ,
11
+ "prefix" : " if" ,
12
+ "body" : [
13
+ " if ${1:command}; then" ,
14
+ " \t $0" ,
15
+ " fi"
16
+ ]
17
+ },
18
+ "if-else" : {
19
+ "description" : " [if] [e]lse" ,
20
+ "prefix" : " if-else" ,
21
+ "body" : [
22
+ " if ${1:command}; then" ,
23
+ " \t ${2:echo}" ,
24
+ " else" ,
25
+ " \t $0" ,
26
+ " fi"
27
+ ]
28
+ },
29
+ "while" : {
30
+ "description" : " [wh]ile" ,
31
+ "prefix" : " while" ,
32
+ "body" : [
33
+ " while ${1:command}; do" ,
34
+ " \t $0" ,
35
+ " done"
36
+ ]
37
+ },
38
+ "until" : {
39
+ "description" : " [un]til" ,
40
+ "prefix" : " until" ,
41
+ "body" : [
42
+ " until ${1:command}; do" ,
43
+ " \t $0" ,
44
+ " done"
45
+ ]
46
+ },
47
+ "for" : {
48
+ "description" : " [fo]r" ,
49
+ "prefix" : " for" ,
50
+ "body" : [
51
+ " for ${1:variable} in ${2:list}; do" ,
52
+ " \t $0" ,
53
+ " done"
54
+ ]
55
+ },
56
+ "function" : {
57
+ "description" : " [fu]nction" ,
58
+ "prefix" : " function" ,
59
+ "body" : [
60
+ " ${1:function_name}() {" ,
61
+ " \t $0" ,
62
+ " }"
63
+ ]
64
+ },
65
+ "main" : {
66
+ "description" : " [ma]in" ,
67
+ "prefix" : " main" ,
68
+ "body" : [
69
+ " main() {" ,
70
+ " \t $0" ,
71
+ " }"
72
+ ]
73
+ },
74
+ ":-" : {
75
+ "description" : " [:-] expansion" ,
76
+ "prefix" : " :-" ,
77
+ "body" : [
78
+ " \"\\ ${${1:variable}:-${2:default}}\" "
79
+ ]
80
+ },
81
+ ":=" : {
82
+ "description" : " [:=] expansion" ,
83
+ "prefix" : " :=" ,
84
+ "body" : [
85
+ " \"\\ ${${1:variable}:=${2:default}}\" "
86
+ ]
87
+ },
88
+ ":?" : {
89
+ "description" : " [:?] expansion" ,
90
+ "prefix" : " :?" ,
91
+ "body" : [
92
+ " \"\\ ${${1:variable}:?${2:error_message}}\" "
93
+ ]
94
+ },
95
+ ":+" : {
96
+ "description" : " [:+] expansion" ,
97
+ "prefix" : " :+" ,
98
+ "body" : [
99
+ " \"\\ ${${1:variable}:+${2:alternative}}\" "
100
+ ]
101
+ },
102
+ "#" : {
103
+ "description" : " [#] expansion" ,
104
+ "prefix" : " #" ,
105
+ "body" : [
106
+ " \"\\ ${${1:variable}#${2:pattern}}\" "
107
+ ]
108
+ },
109
+ "##" : {
110
+ "description" : " [##] expansion" ,
111
+ "prefix" : " ##" ,
112
+ "body" : [
113
+ " \"\\ ${${1:variable}##${2:pattern}}\" "
114
+ ]
115
+ },
116
+ "%" : {
117
+ "description" : " [%] expansion" ,
118
+ "prefix" : " %" ,
119
+ "body" : [
120
+ " \"\\ ${${1:variable}%${2:pattern}}\" "
121
+ ]
122
+ },
123
+ "%%" : {
124
+ "description" : " [%%] expansion" ,
125
+ "prefix" : " %%" ,
126
+ "body" : [
127
+ " \"\\ ${${1:variable}%%${2:pattern}}\" "
128
+ ]
129
+ },
130
+ ".." : {
131
+ "description" : " brace expansion" ,
132
+ "prefix" : " .." ,
133
+ "body" : [
134
+ " {${1:from}..${2:to}}"
135
+ ]
136
+ },
137
+ "echo" : {
138
+ "description" : " [echo]" ,
139
+ "prefix" : " echo" ,
140
+ "body" : [
141
+ " echo \" ${1:message}\" "
142
+ ]
143
+ },
144
+ "printf" : {
145
+ "description" : " [printf]" ,
146
+ "prefix" : " printf" ,
147
+ "body" : [
148
+ " printf '%s' \" ${1:message}\" "
149
+ ]
150
+ },
151
+ "source" : {
152
+ "description" : " [source]" ,
153
+ "prefix" : " source" ,
154
+ "body" : [
155
+ " source \" ${1:path/to/file}\" "
156
+ ]
157
+ },
158
+ "alias" : {
159
+ "description" : " [alias]" ,
160
+ "prefix" : " alias" ,
161
+ "body" : [
162
+ " alias ${1:name}=${2:value}"
163
+ ]
164
+ },
165
+ "cd" : {
166
+ "description" : " [cd]" ,
167
+ "prefix" : " cd" ,
168
+ "body" : [
169
+ " cd \" ${1:path/to/directory}\" "
170
+ ]
171
+ },
172
+ "getopts" : {
173
+ "description" : " [getopts]" ,
174
+ "prefix" : " getopts" ,
175
+ "body" : [
176
+ " getopts ${1:optstring} ${2:name}"
177
+ ]
178
+ },
179
+ "jobs" : {
180
+ "description" : " [jobs]" ,
181
+ "prefix" : " jobs" ,
182
+ "body" : [
183
+ " jobs -x ${1:command}"
184
+ ]
185
+ },
186
+ "kill" : {
187
+ "description" : " [kill]" ,
188
+ "prefix" : " kill" ,
189
+ "body" : [
190
+ " kill ${1|-l,-L|}"
191
+ ]
192
+ },
193
+ "let" : {
194
+ "description" : " [let]" ,
195
+ "prefix" : " let" ,
196
+ "body" : [
197
+ " let ${1:argument}"
198
+ ]
199
+ },
200
+ "test" : {
201
+ "description" : " [test]" ,
202
+ "prefix" : " test" ,
203
+ "body" : [
204
+ " [[ ${1:argument1} ${2|-ef,-nt,-ot,==,=,!=,=~,<,>,-eq,-ne,-lt,-le,-gt,-ge|} ${3:argument2} ]]"
205
+ ]
206
+ },
207
+ "stream" : {
208
+ "description" : " [de]vice name" ,
209
+ "prefix" : " dev" ,
210
+ "body" : [
211
+ " /dev/${1|null,stdin,stdout,stderr|}"
212
+ ]
213
+ },
214
+ "sed:filter-lines" : {
215
+ "description" : " [sed:filter-lines]" ,
216
+ "prefix" : " sed:filter-lines" ,
217
+ "body" : [
218
+ " sed ${1|--regexp-extended,-E|} ${2|--quiet,-n|} '/${3:pattern}/' ${4:path/to/file}"
219
+ ]
220
+ },
221
+ "awk:filter-lines" : {
222
+ "description" : " [awk:filter-lines]" ,
223
+ "prefix" : " awk:filter-lines" ,
224
+ "body" : [
225
+ " awk '/${1:pattern}/' ${2:path/to/file}"
226
+ ]
227
+ }
228
+ }
0 commit comments