From 9cc9895b75f03f59f8982964edef3b136bf52ad8 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Mon, 30 May 2022 19:39:29 +0200 Subject: [PATCH 01/19] sort and structure --- doc/getting-started.md | 56 +++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 52bbe60c6c..c8352a4d28 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -5,6 +5,9 @@ default_highlighter: oil-sh Getting Started =============== +The [releases page](https://www.oilshell.org/releases.html) links to downloads +and documentation (incl. this page) for every release. + There are many ways to use Oil! - You can use it *interactively*, or you can write "shell scripts" with it. @@ -29,13 +32,30 @@ more documentation.
+ Task + | ++ Usage + | +
+ **Running an existing script** as initially written for other shells. * Usually not even minimal quoting/spacing adjustments needed. (Adjustments may only be required due to implementing the "Common Subset" of consistent and sane shell execution compatibility. For example, if a script was using an inconsistent associative array pattern, or relied on dynamic parsing.) NB: By default, basic Oil language features without a side-effect beyond occupying namespace do already work as well (e.g. `const`/`var`/`setvar` incl. Oil expressions, `read --line/all/qsn/-0/...`, `write`, etc). So, these only break in other shells if not shipping a fallback. + |
+
+ Execute script in osh interpreter:`osh my.sh` Or, adapt script, and let it begin with: ```#!/usr/bin/env osh``` + |
+
+ **...and, lint shell fragilities.** * Improved scripts will run with less errors in other shells. NB: The example on the right enables all strict options at once, but individual strict_* options allow fixing issue by issue. + |
+
+ Add a line near the top of the script, to set a shell option with error fallback (keep #!/shebang): "shopt --set strict:all 2>/dev/null || true" *After that* execute the script in osh:`osh my.sh` + |
+
+ **...and, allow adding new Oil language syntax.** * Only a minimized amount of legacy code will need adjustments. * However, adding new syntax/semantics to a script will drop compatibility with other shells. (The adjustments needed in legacy code should mostly be just quoting/spacing, for disambiguation. Except, the requirement for proper error handling, and to add explicit split/glob functions to variables due to [Simple Word Evaluation](http://www.oilshell.org/release/latest/doc/simple-word-eval.html) default. Of course only where variables were originally left correctly(!) unquoted and split/globbed.) + |
+ + Adapt script to begin with: `#!/usr/bin/env osh` `shopt --set oil:upgrade` + | +
+ Coming pretty close to the Oil interpreter. (Intersection of osh & oil & strict.) + |
+ + `#!/usr/bin/env osh` `shopt --set oil:upgrade strict:all` + | +
+ **Using all of the Oil interpeter.** * Implements all positive features of classic shells, compatibly. * All identified pitfalls removed. * Gracefully adding the best from Python, JavaScript and others. (Everything parsed as Oil syntax. Only unavoidable Oil language warts remain.) + |
+ + Adapt script to begin with: `#!/usr/bin/env osh` `shopt --set oil:all` Or, simply use: `#!/usr/bin/env oil` + | +
+
Task
-
- |
+
+ |
Usage
-
- | |
**Running an existing script** as initially written for other shells. * Usually not even minimal quoting/spacing adjustments needed. (Adjustments may only be required due to implementing the "Common Subset" of consistent and sane shell execution compatibility. For example, if a script was using an inconsistent associative array pattern, or relied on dynamic parsing.) NB: By default, basic Oil language features without a side-effect beyond occupying namespace do already work as well (e.g. `const`/`var`/`setvar` incl. Oil expressions, `read --line/all/qsn/-0/...`, `write`, etc). So, these only break in other shells if not shipping a fallback. |
@@ -126,6 +124,7 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH).
Adapt script to begin with: `#!/usr/bin/env osh` `shopt --set oil:all` Or, simply use: `#!/usr/bin/env oil`
- Add a line near the top of the script, to set a shell option with error fallback (keep #!/shebang): "shopt --set strict:all 2>/dev/null || true" *After that* execute the script in osh:`osh my.sh` + Add a line near the top of the script, to set a shell option with error fallback (keep #!/shebang):`shopt --set strict:all 2>/dev/null || true` *After that* execute the script in osh:`osh my.sh` |
- Task - | -- Usage - | -
---|---|
- **Running an existing script** as initially written for other shells. * Usually not even minimal quoting/spacing adjustments needed. ([Particular adjustments](https://www.oilshell.org/release/latest/doc/known-differences.html) may only be required due to implementing the "Common Subset" of consistent and sane shell execution compatibility. For example, if a script was using an inconsistent associative array pattern, or relied on dynamic parsing.) NB: By default, basic Oil language features without a side-effect beyond occupying namespace do already work as well (e.g. `const`/`var`/`setvar` incl. Oil expressions, `read --line/all/qsn/-0/...`, `write`, etc). So, these only break in other shells if not shipping a fallback. - |
-
- Execute script in osh interpreter:`osh my.sh` Or, adapt script, and let it begin with: ```#!/usr/bin/env osh``` - |
-
+ Task + | ++ Usage + | +
+ **Running an existing script** as initially written for other shells. * Usually not even minimal quoting/spacing adjustments needed. ([Particular adjustments](https://www.oilshell.org/release/latest/doc/known-differences.html) may only be required due to implementing the "Common Subset" of consistent and sane shell execution compatibility. For example, if a script was using an inconsistent associative array pattern, or relied on dynamic parsing.) NB: By default, basic Oil language features without a side-effect beyond occupying namespace do already work as well (e.g. `const`/`var`/`setvar` incl. Oil expressions, `read --line/all/qsn/-0/...`, `write`, etc). So, these only break in other shells if not shipping a fallback. + |
+
+ Execute script in osh interpreter:`osh my.sh` Or, adapt script, and let it begin with: ```#!/usr/bin/env osh``` + |
+
- **...and, lint shell fragilities.** * Improved scripts will run with less errors in other shells. NB: The example on the right enables all strict options at once, but individual strict_* options allow fixing issue by issue. - |
-
- Add a line near the top of the script, to set a shell option with error fallback (keep #!/shebang):`shopt --set strict:all 2>/dev/null || true` *After that* execute the script in osh:`osh my.sh` - |
-
+ **...and, lint shell fragilities.** * Improved scripts will run with less errors in other shells. NB: The example on the right enables all strict options at once, but individual strict_* options allow fixing issue by issue. + |
+
+ Add a line near the top of the script, to set a shell option with error fallback (keep #!/shebang):`shopt --set strict:all 2>/dev/null || true` *After that* execute the script in osh:`osh my.sh` + |
+
- **...and, allow adding new Oil language syntax.** * Adjustments to legacy code will only be needed for a [minimized amount of limited syntax](https://www.oilshell.org/release/latest/doc/deprecations.html). * However, adding new syntax/semantics to a script will drop compatibility with other shells. (The adjustments needed in legacy code should mostly be just quoting/spacing, for disambiguation. Except, requirements for proper error handling, and for explicit split/glob functions on variables due to the default [Simple Word Evaluation](http://www.oilshell.org/release/latest/doc/simple-word-eval.html). Of course only where variables were originally left correctly(!) unquoted and split/globbed.) - |
- - Adapt script to begin with: `#!/usr/bin/env osh` `shopt --set oil:upgrade` - | -
+ **...and, allow adding new Oil language syntax.** * Adjustments to legacy code will only be needed for a [minimized amount of limited syntax](https://www.oilshell.org/release/latest/doc/deprecations.html). * However, adding new syntax/semantics to a script will drop compatibility with other shells. (The adjustments needed in legacy code should mostly be just quoting/spacing, for disambiguation. Except, requirements for proper error handling, and for explicit split/glob functions on variables due to the default [Simple Word Evaluation](http://www.oilshell.org/release/latest/doc/simple-word-eval.html). Of course only where variables were originally left correctly(!) unquoted and split/globbed.) + |
+ + Adapt script to begin with: `#!/usr/bin/env osh` `shopt --set oil:upgrade` + | +
- Coming pretty close to the Oil interpreter. (Intersection of osh & oil & strict.) - |
- - `#!/usr/bin/env osh` `shopt --set oil:upgrade strict:all` - | -
+ Coming pretty close to the Oil interpreter. (Intersection of osh & oil & strict.) + |
+ + `#!/usr/bin/env osh` `shopt --set oil:upgrade strict:all` + | +
- **Using all of the Oil interpeter.** * Implements all positive features of classic shells, compatibly. * All identified pitfalls removed. * Gracefully adding the best from Python, JavaScript and others. (Everything parsed as Oil syntax. Only unavoidable Oil language warts remain.) - |
- - Adapt script to begin with: `#!/usr/bin/env osh` `shopt --set oil:all` Or, simply use: `#!/usr/bin/env oil` - | -
+ **Using all of the Oil interpeter.** * Implements all positive features of classic shells, compatibly. * All identified pitfalls removed. * Gracefully adding the best from Python, JavaScript and others. (Everything parsed as Oil syntax. Only unavoidable Oil language warts remain.) + |
+ + Adapt script to begin with: `#!/usr/bin/env osh` `shopt --set oil:all` Or, simply use: `#!/usr/bin/env oil` + | + +
- **...and, allow adding new Oil language syntax.** * Adjustments to legacy code will only be needed for a [minimized amount of limited syntax](https://www.oilshell.org/release/latest/doc/deprecations.html). * However, adding new syntax/semantics to a script will drop compatibility with other shells. (The adjustments needed in legacy code should mostly be just quoting/spacing, for disambiguation. Except, requirements for proper error handling, and for explicit split/glob functions on variables due to the default [Simple Word Evaluation](http://www.oilshell.org/release/latest/doc/simple-word-eval.html). Of course only where variables were originally left correctly(!) unquoted and split/globbed.) + **...and, allow adding new Oil language syntax.** * Adjustments to legacy code will only be needed for a [minimized amount of limited syntax](https://www.oilshell.org/release/latest/doc/upgrade-breakage.html). * However, adding new syntax/semantics to a script will drop compatibility with other shells. (The adjustments needed in legacy code should mostly be just quoting/spacing, for disambiguation. Except, requirements for proper error handling, and for explicit split/glob/maybe functions on variables due to the default [Simple Word Evaluation](http://www.oilshell.org/release/latest/doc/simple-word-eval.html). Of course only where variables were originally left correctly(!) unquoted and split/globbed.) |
Adapt script to begin with: `#!/usr/bin/env osh` `shopt --set oil:upgrade` |