add functions, positional parameters, case and read

- functions: name() { ...; }, function name { ...; }, return, local,
  unset -f; in pipes, & and $(...) they run in a subshell that gets all
  function definitions and the positional parameters
- positional parameters $0, $1 ... ${10}, $#, "$@", "$*", $$; set by
  gosh script args, gosh -c command name args, function calls,
  source file args and set --; shift; for x without "in"
- case word in pattern|pattern) ...;; esac and { list; } groups
- read [-r] [-p prompt] [name ...] with $IFS splitting and $REPLY

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Florian WaltherandClaude Opus 5.5 committed 2026-10-04 17:20:59 +02:00
1 parent 9fe8b06fba
commit 443367f66f
9 files changed
+1629 -98

No files matched your search

+1 -1
View File
@@ -941,7 +941,7 @@ func TestSplitWords(t *testing.T) {
{`echo x${GOSH_A}y`, []string{"echo", "xa by"}},
// Escaped and lone dollar signs stay literal
{`echo \$GOSH_A "\$GOSH_A"`, []string{"echo", "$GOSH_A", "$GOSH_A"}},
{`echo $ 5$ $1`, []string{"echo", "$", "5$", "$1"}},
{`echo $ 5$ $%`, []string{"echo", "$", "5$", "$%"}},
// Backslash in double quotes only escapes $ " \ and `
{`echo "a\nb\\c"`, []string{"echo", `a\nb\c`}},
// Defaults