From 6771c4aa2297c053d65111135bbf48f1b79b1ae0 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Wed, 28 May 2025 16:32:05 +0200 Subject: [PATCH] ljadslkjdsalkj --- snippets/shell script.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snippets/shell script.json b/snippets/shell script.json index c566a4a..1600738 100644 --- a/snippets/shell script.json +++ b/snippets/shell script.json @@ -93,7 +93,8 @@ }, "read-array": { "prefix": "read-array", - "body": "declare -a ${2:test}=()\nreadarray -td \\$'${3:\\n}' ${2:test} < <( ${4:CMD} )$0", + // "body": "declare -a ${2:test}=()\nreadarray -td \\$'${3:\\n}' ${2:test} < <( ${4:CMD} )$0", + "body": "declare -a ${2:test}=()\nreadarray -td \\$'${3:\\n}' ${2:test} <<<\"\\$( ${4:CMD} )\"$0", "description": "Bash snippet 'read-array'" }, "escape-array": { @@ -114,7 +115,7 @@ }, "subshell-multiline": { "prefix": "subshell-multiline", - "body": "${1:tmpcmd}() {\n\t${2:BODY}\n}\n\"\\$(declare -f ${1:tmpcmd}); ${1:tmpcmd} \\\"\\\\\\$@\\\"\"\nunset -f ${1:tmpcmd}$0", + "body": "! declare -F ${1:tmpcmd} >&/dev/null || ! echo >&2 \"ERROR: ${1:tmpcmd}() already declared!\"\n${1:tmpcmd}() {\n\t${2:BODY}\n}\n\"\\$(declare -f ${1:tmpcmd}); ${1:tmpcmd} \\\"\\\\\\$@\\\"\"\nunset -f ${1:tmpcmd}$0", "description": "Bash snippet 'subshell-multiline'" }, "math": {