diff --git a/snippets/shell script.json b/snippets/shell script.json index 0a250ab..1e68481 100644 --- a/snippets/shell script.json +++ b/snippets/shell script.json @@ -57,7 +57,7 @@ }, "declare": { "prefix": "declare", - "body": "declare ${1:VAR}=${1:EXPR}$0", + "body": "declare ${1:VAR}=${2:EXPR}$0", "description": "Bash snippet 'declare'" }, "array": { @@ -85,6 +85,11 @@ "body": "local -a ${2:test}\nreadarray -d \\$'${3:\\n}' -t ${2:test} < <( ${4:CMD} )$0", "description": "Bash snippet 'read-array'" }, + "escape-array": { + "prefix": "escape-array", + "body": "readarray -d \\$'\\n' -t ${1:array} < <(printf \"%q\\n\" \"\\${${1:array}[@]}\")$0", + "description": "Bash snippet 'read-array'" + }, "variable": { "prefix": "var", // "body": "${2:\"}\\$${3:{}$1${3:\\}}${2:\"}$0", // TODO: crashes zed @@ -113,7 +118,7 @@ }, "printf": { "prefix": "printf", - "body": "printf${2: >&${1:1}} '${3:%s}\\n' ${4:args}$0", + "body": "printf${2: >&${1:1}} \"${3:%s}\\n\" ${4:args}$0", "description": "Bash snippet 'printf'" }, "echo": {