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.
-## Setup +## Oilshell Usage + +### `sh` and Bash Docs Are Useful for OSH + +Existing educational materials for the Unix shell apply to OSH, because they +generally don't teach the quirks that OSH disallows. For example, much of the +information and advice in [BashGuide][] can be used without worrying about +which shell you're using. See the end of this manual for more resources. + +For this reason, we're focusing the documenting efforts on the [Oil +language][oil-language]. + + +### What Is Expected to Run Under OSH + +"Batch" programs are most likely to run unmodified under OSH. On the other +hand, Interactive programs like `.bashrc` and bash completion scripts may +require small changes. + +- Wiki: [What Is Expected to Run Under OSH]($wiki) + -### Downloading Oil -The [releases page](https://www.oilshell.org/releases.html) links to source -tarballs for every release. It also links to the documentation tree, which -includes this page. +## Configuration ### Your Configuration Dir @@ -67,11 +87,10 @@ them in your `oshrc`. I describe my own `oshrc` file on the Wiki: [How To Test OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). -## Tips - If you get tired of typing `~/.config/oil/oshrc`, symlink it to `~/.oshrc`. -### Troubleshooting +## Troubleshooting - If you're running OSH from `bash` or `zsh`, then the prompt string `$PS1` may be unintentionally inherited. Running `PS1=''` before `bin/osh` avoids this. @@ -80,23 +99,9 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). `/etc/profile`. Adding `source /etc/profile` to your `oshrc` may solve this problem. -### `sh` and Bash Docs Are Useful for OSH - -Existing educational materials for the Unix shell apply to OSH, because they -generally don't teach the quirks that OSH disallows. For example, much of the -information and advice in [BashGuide][] can be used without worrying about -which shell you're using. See the end of this manual for more resources. -For this reason, we're focusing efforts on documenting the [Oil -language][oil-language]. -## What Is Expected to Run Under OSH -"Batch" programs are most likely to run unmodified under OSH. On the other -hand, Interactive programs like `.bashrc` and bash completion scripts may -require small changes. - -- Wiki: [What Is Expected to Run Under OSH]($wiki) ## Features Unique to OSH @@ -201,13 +206,20 @@ Related: This is implemented, but a JSON library isn't in the release build. -### More + + + + +## Features Unique to Oil For more features unique to Oil, see [Why Use Oil?][why] [why]: https://www.oilshell.org/why.html + + + ## Appendix ### Bugs From 2bafe1e8e821f93f76723be4a08ea0b0a9bafaed Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Mon, 30 May 2022 20:16:56 +0200 Subject: [PATCH 02/19] more sorting and inserting of usage table --- doc/getting-started.md | 117 +++++++++++++++++++++++++++++++---------- 1 file changed, 89 insertions(+), 28 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index c8352a4d28..baaa88b027 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -5,12 +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. +Oilshell can be used for different things! -There are many ways to use Oil! - -- You can use it *interactively*, or you can write "shell scripts" with it. +- You can use it *interactively*, or run and write "shell scripts" in it. Shell is the best language for *ad hoc* automation. - You can use it in *compatible* mode with `bin/osh`, or in *legacy-free* mode with `bin/oil`. @@ -32,34 +29,18 @@ more documentation.
-## Oilshell Usage - -### `sh` and Bash Docs Are Useful for OSH - -Existing educational materials for the Unix shell apply to OSH, because they -generally don't teach the quirks that OSH disallows. For example, much of the -information and advice in [BashGuide][] can be used without worrying about -which shell you're using. See the end of this manual for more resources. - -For this reason, we're focusing the documenting efforts on the [Oil -language][oil-language]. - - -### What Is Expected to Run Under OSH - -"Batch" programs are most likely to run unmodified under OSH. On the other -hand, Interactive programs like `.bashrc` and bash completion scripts may -require small changes. - -- Wiki: [What Is Expected to Run Under OSH]($wiki) +## Install / Setup / Config (move this into INSTALL ?) +### Download +The [releases page](https://www.oilshell.org/releases.html) links to downloads +and documentation (incl. this page) for every release. -## Configuration +After downloading follow the instructions in [INSTALL](INSTALL.html) -### Your Configuration Dir +### Optional Configuration Directory -After running the instructions in [INSTALL](INSTALL.html), run: +After creating the directory: mkdir -p ~/.config/oil @@ -90,6 +71,86 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). - If you get tired of typing `~/.config/oil/oshrc`, symlink it to `~/.oshrc`. + + + +## Oilshell (OSH/Oil) Usage + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 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` +
+ + +### What Is Expected to Run Under OSH + +"Batch" programs are most likely to run unmodified under OSH. On the other +hand, Interactive programs like `.bashrc` and bash completion scripts may +require small changes. + +- Wiki: [What Is Expected to Run Under OSH]($wiki) + + +### `sh` and Bash Docs Are Useful for OSH + +Existing educational materials for the Unix shell apply to OSH, because they +generally don't teach the quirks that OSH disallows. For example, much of the +information and advice in [BashGuide][] can be used without worrying about +which shell you're using. See the end of this manual for more resources. + +For this reason, we're focusing the documenting efforts on the [Oil +language][oil-language]. + + + + ## Troubleshooting - If you're running OSH from `bash` or `zsh`, then the prompt string `$PS1` may From be671fe85f92bd594011b79e65639cacb1d52ceb Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Mon, 30 May 2022 20:24:13 +0200 Subject: [PATCH 03/19] more fixes table header --- doc/getting-started.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index baaa88b027..d19037f43a 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -22,8 +22,6 @@ See [blog posts tagged #FAQ][blog-faqs] for more detail. [oil-language]: https://www.oilshell.org/cross-ref.html?tag=oil-language#oil-language [osh-language]: https://www.oilshell.org/cross-ref.html?tag=osh-language#osh-language -This doc walks you through setting up Oil, explains some concepts, and links to -more documentation.
@@ -78,15 +76,15 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). - - + - + + + @@ -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` +
+
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.
From 946d085918d68e018c3ea1ba0c88ca5fc9d36e84 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Mon, 30 May 2022 22:37:54 +0200 Subject: [PATCH 04/19] Oilshell as osh and oil --- doc/getting-started.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index d19037f43a..2c76d89ee0 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -5,11 +5,11 @@ default_highlighter: oil-sh Getting Started =============== -Oilshell can be used for different things! +Oilshell provides different things! -- You can use it *interactively*, or run and write "shell scripts" in it. - Shell is the best language for *ad hoc* automation. -- You can use it in *compatible* mode with `bin/osh`, or in *legacy-free* mode +- You can use it *interactively*, or run and write "shell scripts" in it.
+ (Shell is the best language for *ad hoc* automation.) +- You can use its *compatible* language mode with `bin/osh`, or its *legacy-free* language mode with `bin/oil`. As of 2021, the [OSH language][osh-language] is mature, and the [Oil @@ -72,7 +72,7 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). -## Oilshell (OSH/Oil) Usage +## Oilshell Usage (as osh and oil) From 07fc740b7b633dff4fd5a81f6a819fcf6e81d77f Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Mon, 30 May 2022 22:57:41 +0200 Subject: [PATCH 05/19] multi-purpose oilshell interpreter --- doc/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 2c76d89ee0..3625bb885d 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -5,11 +5,11 @@ default_highlighter: oil-sh Getting Started =============== -Oilshell provides different things! +Oilshell provides a multi-purpose runtime-interpreter. - You can use it *interactively*, or run and write "shell scripts" in it.
(Shell is the best language for *ad hoc* automation.) -- You can use its *compatible* language mode with `bin/osh`, or its *legacy-free* language mode +- You can use a language that's *compatible* with other shells `bin/osh`, or a *legacy-free* language mode with `bin/oil`. As of 2021, the [OSH language][osh-language] is mature, and the [Oil From 8d383ca31eaa445928ec791859adf1d9b915b90f Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Mon, 30 May 2022 23:06:16 +0200 Subject: [PATCH 06/19] Update getting-started.md --- doc/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 3625bb885d..1fb793c4b8 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -9,8 +9,8 @@ Oilshell provides a multi-purpose runtime-interpreter. - You can use it *interactively*, or run and write "shell scripts" in it.
(Shell is the best language for *ad hoc* automation.) -- You can use a language that's *compatible* with other shells `bin/osh`, or a *legacy-free* language mode - with `bin/oil`. +- You can use a language that's *compatible* with other shells in `bin/osh`, or the much improved *legacy-free* oil language + in `bin/oil`. As of 2021, the [OSH language][osh-language] is mature, and the [Oil language][oil-language] is under development. The interactive shell exists, From d8a88b0fa268a94e77c853d41666fb199dd8adfe Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Mon, 30 May 2022 23:11:00 +0200 Subject: [PATCH 07/19] markup --- doc/getting-started.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 1fb793c4b8..cb7f0a0390 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -9,8 +9,9 @@ Oilshell provides a multi-purpose runtime-interpreter. - You can use it *interactively*, or run and write "shell scripts" in it.
(Shell is the best language for *ad hoc* automation.) -- You can use a language that's *compatible* with other shells in `bin/osh`, or the much improved *legacy-free* oil language - in `bin/oil`. + +- You can use a language that's *compatible* with other shells in `bin/osh`,
+ or the much improved *legacy-free* oil language in `bin/oil`. As of 2021, the [OSH language][osh-language] is mature, and the [Oil language][oil-language] is under development. The interactive shell exists, From 212b2ec8b246caed89b0f4a4c4a501b4740898b7 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Mon, 30 May 2022 23:31:31 +0200 Subject: [PATCH 08/19] markup --- doc/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index cb7f0a0390..2554caf731 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -98,7 +98,7 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-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. From 7a511353f488be47bf08f05a36f66891381971df Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Tue, 31 May 2022 07:16:42 +0200 Subject: [PATCH 09/19] oilshell explanation polish --- doc/getting-started.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 2554caf731..6e12ba66ea 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -5,13 +5,13 @@ default_highlighter: oil-sh Getting Started =============== -Oilshell provides a multi-purpose runtime-interpreter. +Oilshell provides a **multi-purpose interpreter** runtime. -- You can use it *interactively*, or run and write "shell scripts" in it.
+- You can use it *interactively*, or run and write "shell scripts" for it.
(Shell is the best language for *ad hoc* automation.) -- You can use a language that's *compatible* with other shells in `bin/osh`,
- or the much improved *legacy-free* oil language in `bin/oil`. +- You can start it for a language that's *compatible* with other shells (using `bin/osh`),
+ or for the much improved *legacy-free* oil language (using `bin/oil`). As of 2021, the [OSH language][osh-language] is mature, and the [Oil language][oil-language] is under development. The interactive shell exists, From f5c4b7c6881e27f26b1f51d66241f9684ecc1905 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Tue, 31 May 2022 07:30:33 +0200 Subject: [PATCH 10/19] polish description some more --- doc/getting-started.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 6e12ba66ea..625f97a068 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -10,8 +10,9 @@ Oilshell provides a **multi-purpose interpreter** runtime. - You can use it *interactively*, or run and write "shell scripts" for it.
(Shell is the best language for *ad hoc* automation.) -- You can start it for a language that's *compatible* with other shells (using `bin/osh`),
- or for the much improved *legacy-free* oil language (using `bin/oil`). +- You can start it to use a language that's *compatible* with other shells (using `bin/osh`),
+ or, to use the much improved Oil language, a very coherent *pitfall-freed* shell upgrade with
+ selected python/js/etc. features (using `bin/oil`). As of 2021, the [OSH language][osh-language] is mature, and the [Oil language][oil-language] is under development. The interactive shell exists, From 64d1cca53c96751d990114b81d8b331d2680845f Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Tue, 31 May 2022 11:54:21 +0200 Subject: [PATCH 11/19] link to preliminary doc overview --- doc/getting-started.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 625f97a068..fd880702a7 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -129,7 +129,10 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH).
- 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`
- + + For more information see: https://www.oilshell.org/release/latest#Documentation + + ### What Is Expected to Run Under OSH "Batch" programs are most likely to run unmodified under OSH. On the other From f673b99986358d1b385ae29c2d78a7f918926c3f Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Tue, 31 May 2022 12:19:43 +0200 Subject: [PATCH 12/19] link to doc/deprecations --- doc/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index fd880702a7..36d317dfc2 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -104,7 +104,7 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). - **...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.) + **...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, 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` From 3a57fe26832d8c6071f04d709ac53059b690d83b Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Tue, 31 May 2022 12:23:18 +0200 Subject: [PATCH 13/19] polish sentence --- doc/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 36d317dfc2..49996901f7 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -104,7 +104,7 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). - **...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, 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.) + **...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` From 08c1b92f85bfbd509bd06963e31e2085f4a30bc7 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Tue, 31 May 2022 12:27:06 +0200 Subject: [PATCH 14/19] link doc/known-differences --- doc/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 49996901f7..04dc1fbef4 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -88,7 +88,7 @@ OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). - **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. + **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``` From 08cbb0e372ae192f34d75bc72a4a4bef20e806e1 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Fri, 3 Jun 2022 16:03:47 +0200 Subject: [PATCH 15/19] remove the part going into INSTALL --- doc/getting-started.md | 140 +++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 88 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 04dc1fbef4..c956e377f6 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -29,108 +29,72 @@ See [blog posts tagged #FAQ][blog-faqs] for more detail.
-## Install / Setup / Config (move this into INSTALL ?) - -### Download - -The [releases page](https://www.oilshell.org/releases.html) links to downloads -and documentation (incl. this page) for every release. - -After downloading follow the instructions in [INSTALL](INSTALL.html) - -### Optional Configuration Directory - -After creating the directory: - - mkdir -p ~/.config/oil - -OSH will create `osh_history` there to store your command history. - -### Initialization with `rc` Files - -You can also create your own startup files in this directory: - -- `bin/osh` runs `~/.config/oil/oshrc` -- `bin/oil` runs `~/.config/oil/oilrc` - -These are the **only** files that are "sourced". Other shells [have a -confusing initialization sequence involving many files][mess] ([original][]). -It's very hard to tell when and if `/etc/profile`, `~/.bashrc`, -`~/.bash_profile`, etc. are executed. - -OSH and Oil intentionally avoid this. If you want those files, simply `source` -them in your `oshrc`. - -[mess]: https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/ - -[original]: http://www.solipsys.co.uk/new/BashInitialisationFiles.html - -I describe my own `oshrc` file on the Wiki: [How To Test -OSH](https://github.com/oilshell/oil/wiki/How-To-Test-OSH). - - -- If you get tired of typing `~/.config/oil/oshrc`, symlink it to `~/.oshrc`. - +## Install +If you haven't already done so, the downloads and install instructions +can be found on the [releases page](https://www.oilshell.org/releases.html). ## Oilshell Usage (as osh and oil) - - - - - - - - + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - + + + +
- 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` +
- For more information see: https://www.oilshell.org/release/latest#Documentation +The full documentation is at: https://www.oilshell.org/release/latest#Documentation ### What Is Expected to Run Under OSH From 7d2dc99fddad84de464a2f96fc31f5ca8d0a84e3 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Fri, 3 Jun 2022 16:28:06 +0200 Subject: [PATCH 16/19] remove / from br markup --- doc/getting-started.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index c956e377f6..59b19777c2 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -7,11 +7,11 @@ Getting Started Oilshell provides a **multi-purpose interpreter** runtime. -- You can use it *interactively*, or run and write "shell scripts" for it.
+- You can use it *interactively*, or run and write "shell scripts" for it.
(Shell is the best language for *ad hoc* automation.) -- You can start it to use a language that's *compatible* with other shells (using `bin/osh`),
- or, to use the much improved Oil language, a very coherent *pitfall-freed* shell upgrade with
+- You can start it to use a language that's *compatible* with other shells (using `bin/osh`),
+ or, to use the much improved Oil language, a very coherent *pitfall-freed* shell upgrade with
selected python/js/etc. features (using `bin/oil`). As of 2021, the [OSH language][osh-language] is mature, and the [Oil @@ -52,42 +52,42 @@ can be found on the [releases page](https://www.oilshell.org/releases.html). - **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. + **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``` + 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. + **...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` + 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.) + **...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` + 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.) + Coming pretty close to the Oil interpreter.
(Intersection of osh & oil & strict.) - `#!/usr/bin/env osh`
`shopt --set oil:upgrade strict:all`
                                                                     + `#!/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.) + **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` + Adapt script to begin with:
`#!/usr/bin/env osh`
`shopt --set oil:all`

Or, simply use:
`#!/usr/bin/env oil` From f6703b1265d212cc46b8d81c01280c8b553d3194 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Fri, 3 Jun 2022 17:21:42 +0200 Subject: [PATCH 17/19] Don't use project/domain name in "Usage" title. --- doc/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 59b19777c2..621f143026 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -35,7 +35,7 @@ If you haven't already done so, the downloads and install instructions can be found on the [releases page](https://www.oilshell.org/releases.html). -## Oilshell Usage (as osh and oil) +## Usage (as osh and oil) From e1ff4da19135eb356d6517f86907be53a46ab48d Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Fri, 3 Jun 2022 17:30:20 +0200 Subject: [PATCH 18/19] refer only to "the project" at the top (not mismatching oil/oilshell) --- doc/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index 621f143026..cf68a8a5bd 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -5,7 +5,7 @@ default_highlighter: oil-sh Getting Started =============== -Oilshell provides a **multi-purpose interpreter** runtime. +The project provides a **multi-purpose interpreter** (runtime). - You can use it *interactively*, or run and write "shell scripts" for it.
(Shell is the best language for *ad hoc* automation.) From 6395e29a3bc77856049385297dcf4db8ca5cc687 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Tue, 14 Jun 2022 23:12:07 +0200 Subject: [PATCH 19/19] upgrade-breakage url --- doc/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/getting-started.md b/doc/getting-started.md index cf68a8a5bd..01dcd41fad 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -68,7 +68,7 @@ can be found on the [releases page](https://www.oilshell.org/releases.html).
- **...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`