add parameter expansion, arithmetic, set -e/-x/pipefail, trap, eval, exec
- ${#v}, ${v#p} ${v##p} ${v%p} ${v%%p}, ${v/p/r} ${v//p/r} ${v/#p/r}
${v/%p/r}, ${v:off:len}, ${v-w} ${v:=w} ${v:+w} ${v:?msg}; nested ${}
- arithmetic expansion $((...)) with the C operators, ** and assignments
- set -e, set -x, set -o pipefail (also as gosh options, passed on to
subshells); set shows variables, set -o the options
- trap for EXIT and signals; scripts with an EXIT trap run it on
SIGINT/SIGTERM/SIGHUP too
- eval, exec (also exec > file without a command), $!, wait pid
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f66cf538c0
commit
1f507f6562
20 files changed
+2408
-93
No files matched your search
+4
-4
@@ -247,12 +247,12 @@ func escapeHereBody(body string) string {
|
||||
b.WriteString("$*")
|
||||
i++
|
||||
case strings.HasPrefix(body[i:], "${"):
|
||||
end := strings.IndexByte(body[i:], '}')
|
||||
end := paramEnd(body, i)
|
||||
if end < 0 {
|
||||
end = len(body) - i - 1
|
||||
end = len(body) - 1
|
||||
}
|
||||
b.WriteString(strings.Replace(body[i:i+end+1], "${@", "${*", 1))
|
||||
i += end
|
||||
b.WriteString(strings.Replace(body[i:end+1], "${@", "${*", 1))
|
||||
i = end
|
||||
case c == '\\' && i+1 < len(body) && strings.IndexByte("$`\\\n", body[i+1]) >= 0:
|
||||
b.WriteString(body[i : i+2])
|
||||
i++
|
||||
|
||||
Reference in new issue
Block a user