make default settings for bash more reliable
see http://redsymbol.net/articles/unofficial-bash-strict-mode/ for explanation why this might be useful.
This commit is contained in:
parent
b66ede5e0f
commit
65211115a0
@ -33,6 +33,10 @@ snippet !env "#!/usr/bin/env (!env)"
|
|||||||
`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" `
|
`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" `
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet sbash "safe bash options"
|
||||||
|
`!p snip.rv = '#!/usr/bin/env bash' + "\nset -euo pipefail\nIFS=$'\n\t'" + "\n\n" `
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet temp "Tempfile"
|
snippet temp "Tempfile"
|
||||||
${1:TMPFILE}="$(mktemp -t ${2:`!p
|
${1:TMPFILE}="$(mktemp -t ${2:`!p
|
||||||
snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled"
|
snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled"
|
||||||
|
@ -5,6 +5,11 @@ snippet #!
|
|||||||
snippet bash
|
snippet bash
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
snippet sbash
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
snippet if
|
snippet if
|
||||||
if [[ ${1:condition} ]]; then
|
if [[ ${1:condition} ]]; then
|
||||||
${0:#statements}
|
${0:#statements}
|
||||||
|
Loading…
Reference in New Issue
Block a user