diff --git a/README.md b/README.md index f306a6d..8000b53 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ To edit and develop locally install the following packages and run the built in ```bash python3 -m venv env -pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-awesome-pages-plugin mkdocs-minify-plugin source env/bin/activate +pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-awesome-pages-plugin mkdocs-minify-plugin mkdocs serve ``` diff --git a/docs/commands/builtin/eval.md b/docs/commands/builtin/eval.md index 9cd455e..ed97c0f 100644 --- a/docs/commands/builtin/eval.md +++ b/docs/commands/builtin/eval.md @@ -138,7 +138,7 @@ In the case of `eval` it isn't recommended to use this behavior, because unlike e.g. [declare](../../commands/builtin/declare.md), the initial expansion is still subject to all expansions including [word-splitting](../../syntax/expansion/wordsplit.md) and [pathname -expansion](../../syntax/expansion/glob.md). +expansion](../../syntax/expansion/globs.md). $ ( set -x; touch 'x+=(\[[123]\]=*)' 'x+=([3]=yo)'; eval x+=(*); echo "${x[@]}" ) + touch 'x+=(\[[123]\]=*)' 'x+=([3]=yo)' @@ -151,7 +151,7 @@ expansion](../../syntax/expansion/glob.md). Other commands known to be affected by compound assignment arguments include: [let](../../commands/builtin/let.md), [declare](../../commands/builtin/declare.md), -[typeset](../../commands/builtin/typeset.md), [local](../../commands/builtin/local.md), +`typeset`, [local](../../commands/builtin/local.md), [export](../../commands/builtin/export.md), and [readonly](../../commands/builtin/readonly.md). More oddities below show both similarities and differences to commands like diff --git a/docs/commands/builtin/exit.md b/docs/commands/builtin/exit.md index b2b6e3a..b2272e9 100644 --- a/docs/commands/builtin/exit.md +++ b/docs/commands/builtin/exit.md @@ -43,4 +43,4 @@ executed the `exit` command, because the shell exits. ## See also - [The trap builtin command](../../commands/builtin/trap.md) -- [The exit status](../../dict/terms/exit_status.md) +- [The exit status](../../dict/exit_status.md) diff --git a/docs/commands/builtin/local.md b/docs/commands/builtin/local.md index 4646650..0a15a30 100644 --- a/docs/commands/builtin/local.md +++ b/docs/commands/builtin/local.md @@ -54,4 +54,4 @@ way, and takes all the same options, with 3 exceptions: ## See also -- +- [The basics of shell scripting: Variable scope](../../scripting/basics.md#variable-scope) diff --git a/docs/commands/builtin/printf.md b/docs/commands/builtin/printf.md index 92b8800..4292cb2 100644 --- a/docs/commands/builtin/printf.md +++ b/docs/commands/builtin/printf.md @@ -473,4 +473,4 @@ fmt++; - [Code snip: Print a horizontal line](../../snipplets/print_horizontal_line.md) uses some `printf` examples - [Greg's BashFAQ 18: How can I use numbers with leading zeros in a - loop, e.g., 01, 02?](BashFAQ>018) + loop, e.g., 01, 02?](http://mywiki.wooledge.org/BashFAQ/018) diff --git a/docs/commands/builtin/return.md b/docs/commands/builtin/return.md index 1b6a5c3..c3ebecc 100644 --- a/docs/commands/builtin/return.md +++ b/docs/commands/builtin/return.md @@ -32,4 +32,4 @@ comes back, there was a problem in doing the return. ## See also - [The exit builtin command](../../commands/builtin/exit.md) -- [The exit status](../../dict/terms/exit_status.md) +- [The exit status](../../dict/exit_status.md) diff --git a/docs/commands/builtin/shift.md b/docs/commands/builtin/shift.md index 84573f1..e8a45d6 100644 --- a/docs/commands/builtin/shift.md +++ b/docs/commands/builtin/shift.md @@ -62,7 +62,7 @@ There are no options. errors.`$ dash -c 'f() { if shift; then echo "$1"; else echo "no args"; fi; }; f' dash: 1: shift: can't shift that many ` In most shells, you can work around this problem using the - [command](../../commands/builtin/command.md) builtin to suppress fatal + `command` builtin to suppress fatal errors caused by *special builtins*. \$ dash -c \'f() { if command shift 2>/dev/null; then echo \"\$1\"; else echo \"no args\"; fi; }; f\' diff --git a/docs/dict/directory.md b/docs/dict/directory.md index 3fd9672..5b08977 100644 --- a/docs/dict/directory.md +++ b/docs/dict/directory.md @@ -1,7 +1,7 @@ # Directory In terms of UNIX(r), a directory is a special file which contains a list -of [hardlinks](../dict/terms/hardlink.md) to other files. These other files +of [hardlinks](../dict/hardlink.md) to other files. These other files also can be directories of course, so it's possible to create a \"hierarchy of directories\" - the UNIX(r)-typical filesystem structure. @@ -10,6 +10,6 @@ all other directory entries are **subdirectories** of it. ## See also -- [hardlink](../dict/terms/hardlink.md) -- [file](../dict/terms/file.md) -- [special file](../dict/terms/special_file.md) +- [hardlink](../dict/hardlink.md) +- [file](../dict/file.md) +- [special file](../dict/special_file.md) diff --git a/docs/dict/file.md b/docs/dict/file.md index 8e59d70..670b954 100644 --- a/docs/dict/file.md +++ b/docs/dict/file.md @@ -1,24 +1,22 @@ # File -A file is a pool of data in the [filesystem](../dict/terms/filesystem.md). On +A file is a pool of data in the `filesystem`. On userlevel, it's referenced using a name, a -[hardlink](../dict/terms/hardlink.md) to the file. +[hardlink](hardlink.md) to the file. If a file is not referenced anymore (number of hardlinks to it drops to -0) then the space allocated for that file is re-used, unless it's still +1) then the space allocated for that file is re-used, unless it's still used by some process. The file-data splits into actual payload (file contents) and some metadata like filesize, filemode or timestamps. The metadata is stored -in the [inode](../dict/terms/inode.md). +in the `inode`. -Strictly spoken, a [hardlink](../dict/terms/hardlink.md) (also called -\"filename\") points to the [inode](../dict/terms/inode.md) which organizes a +Strictly spoken, a [hardlink](hardlink.md) (also called +\"filename\") points to the `inode` which organizes a file, not to the file itself. ## See also -- [filesystem](../dict/terms/filesystem.md) -- [filetimes](../dict/terms/filetimes.md) -- [hardlink](../dict/terms/hardlink.md) -- [inode](../dict/terms/inode.md) +- [filetimes](filetimes.md) +- [hardlink](hardlink.md) diff --git a/docs/dict/globbing.md b/docs/dict/globbing.md index a204515..f46df75 100644 --- a/docs/dict/globbing.md +++ b/docs/dict/globbing.md @@ -23,8 +23,8 @@ which serves the same purpose. ## See also -- [shell](../dict/terms/shell.md) -- [hardlink](../dict/terms/hardlink.md) +- [shell](../dict/shell.md) +- [hardlink](../dict/hardlink.md) ## See also (article) diff --git a/docs/dict/hardlink.md b/docs/dict/hardlink.md index b4d1598..e558f7f 100644 --- a/docs/dict/hardlink.md +++ b/docs/dict/hardlink.md @@ -4,16 +4,16 @@ Also the article for: - filename -A hardlink associates a *filename* with a [file](../dict/terms/file.md). That +A hardlink associates a *filename* with a [file](../dict/file.md). That name is an entry in a directory listing. Of course a file can have more hardlinks to it (usually the number of hardlinks to a file is limited), but all hardlinks to a file must reside on the same -[filesystem](../dict/terms/filesystem.md) as the file itself! +`filesystem` as the file itself! What you usually call a file is just a name for that file, and thus, a hardlink. -The difference between a [symbolic link](../dict/terms/symlink.md) and a hard +The difference between a [symbolic link](../dict/symlink.md) and a hard link is that there is no easy way to differentiate between a \'real\' file and a hard link, let's take a look at the example: @@ -46,6 +46,5 @@ is freed when the last hard link pointing to it is deleted. ## See also -- [file](../dict/terms/file.md) -- [filesystem](../dict/terms/filesystem.md) -- [symlink](../dict/terms/symlink.md) +- [file](../dict/file.md) +- [symlink](../dict/symlink.md) diff --git a/docs/dict/posix.md b/docs/dict/posix.md index a7658f7..4ee3f19 100644 --- a/docs/dict/posix.md +++ b/docs/dict/posix.md @@ -13,4 +13,4 @@ behaviour of the system shell and some utilities (commands). ## See also -- Dictionary, internal: [shell](../dict/terms/shell.md) +- Dictionary, internal: [shell](../dict/shell.md) diff --git a/docs/dict/special_file.md b/docs/dict/special_file.md index d2b4392..c06a16b 100644 --- a/docs/dict/special_file.md +++ b/docs/dict/special_file.md @@ -14,6 +14,6 @@ too. ## See also -- [file](../dict/terms/file.md) -- [filename](../dict/terms/hardlink.md) -- [directory](../dict/terms/directory.md) +- [file](../dict/file.md) +- [filename](../dict/hardlink.md) +- [directory](../dict/directory.md) diff --git a/docs/dict/symlink.md b/docs/dict/symlink.md index 1e982a9..4a6ed62 100644 --- a/docs/dict/symlink.md +++ b/docs/dict/symlink.md @@ -10,6 +10,5 @@ it can ## See also -- [hardlink](../dict/terms/hardlink.md) -- [filesystem](../dict/terms/filesystem.md) -- [directory](../dict/terms/directory.md) +- [hardlink](../dict/hardlink.md) +- [directory](../dict/directory.md) diff --git a/docs/howto/calculate-dc.md b/docs/howto/calculate-dc.md index e132f03..c5605bc 100644 --- a/docs/howto/calculate-dc.md +++ b/docs/howto/calculate-dc.md @@ -1,6 +1,13 @@ -# Calculating with dc +--- +tags: + - bash + - shell + - scripting + - arithmetic + - calculate +--- -![](keywords>bash shell scripting arithmetic calculate) +# Calculating with dc ## Introduction diff --git a/docs/howto/collapsing_functions.md b/docs/howto/collapsing_functions.md index 34a774e..0d699b9 100644 --- a/docs/howto/collapsing_functions.md +++ b/docs/howto/collapsing_functions.md @@ -1,6 +1,14 @@ -# Collapsing Functions +--- +tags: + - bash + - shell + - scripting + - example + - function + - collapse +--- -![](keywords>bash shell scripting example function collapse) +# Collapsing Functions ## What is a \"Collapsing Function\"? diff --git a/docs/howto/conffile.md b/docs/howto/conffile.md index 0daad90..5360986 100644 --- a/docs/howto/conffile.md +++ b/docs/howto/conffile.md @@ -1,6 +1,15 @@ -# Config files for your script +--- +tags: + - bash + - shell + - scripting + - config + - files + - include + - configuration +--- -![](keywords>bash shell scripting config files include configuration) +# Config files for your script ## General diff --git a/docs/howto/edit-ed.md b/docs/howto/edit-ed.md index b139952..283aca6 100644 --- a/docs/howto/edit-ed.md +++ b/docs/howto/edit-ed.md @@ -1,6 +1,17 @@ -# Editing files via scripts with ed +--- +tags: + - bash + - shell + - scripting + - arguments + - file + - editor + - edit + - ed + - sed +--- -![](keywords>bash shell scripting arguments file editor edit ed sed) +# Editing files via scripts with ed ## Why ed? diff --git a/docs/howto/getopts_tutorial.md b/docs/howto/getopts_tutorial.md index 168f76d..5fcc941 100644 --- a/docs/howto/getopts_tutorial.md +++ b/docs/howto/getopts_tutorial.md @@ -1,6 +1,17 @@ -# Small getopts tutorial +--- +tags: + - bash + - shell + - scripting + - arguments + - positional + - parameters + - options + - getopt + - getopts +--- -![](keywords>bash shell scripting arguments positional parameters options getopt getopts) +# Small getopts tutorial ## Description @@ -82,7 +93,7 @@ left to parse, it's easy to use in a while-loop: parsing on the first non-option argument (a string that doesn't begin with a hyphen (`-`) that isn't an argument for any option in front of it). It will also stop parsing when it sees the `--` (double-hyphen), -which means [end of options](../dict/terms/end_of_options.md). +which means [end of options](../dict/end_of_options.md). ### Used variables diff --git a/docs/howto/mutex.md b/docs/howto/mutex.md index 3fa3114..e098ac2 100644 --- a/docs/howto/mutex.md +++ b/docs/howto/mutex.md @@ -1,6 +1,14 @@ -# Lock your script (against parallel execution) +--- +tags: + - bash + - shell + - scripting + - mutex + - locking + - run-control +--- -![](keywords>bash shell scripting mutex locking run-control) +# Lock your script (against parallel execution) ## Why lock? @@ -84,7 +92,7 @@ atomic. Maybe a while loop checking continously for the existence of the lock in the background and sending a signal such as USR1, if the directory is not found, can be done. The signal would need to be trapped. I am sure there there is a better solution than this -suggestion* --- *[sn18](sunny_delhi18@yahoo.com) 2009/12/19 08:24* +suggestion* --- **sn18** 2009/12/19 08:24* **Note:** While perusing the Internet, I found some people asking if the `mkdir` method works \"on all filesystems\". Well, let's say it should. diff --git a/docs/howto/pax.md b/docs/howto/pax.md index dd209af..507cbaa 100644 --- a/docs/howto/pax.md +++ b/docs/howto/pax.md @@ -1,6 +1,16 @@ -# pax - the POSIX archiver +--- +tags: + - bash + - shell + - scripting + - POSIX + - archive + - tar + - packing + - zip +--- -![](keywords>bash shell scripting POSIX archive tar packing zip) +# pax - the POSIX archiver pax can do a lot of fancy stuff, feel free to contribute more awesome pax tricks! diff --git a/docs/howto/redirection_tutorial.md b/docs/howto/redirection_tutorial.md index 7bfa892..00ba219 100644 --- a/docs/howto/redirection_tutorial.md +++ b/docs/howto/redirection_tutorial.md @@ -1,6 +1,16 @@ -# Illustrated Redirection Tutorial +--- +tags: + - bash + - shell + - scripting + - tutorial + - redirection + - redirect + - file + - descriptor +--- -![](keywords>bash shell scripting tutorial redirection redirect file descriptor) +# Illustrated Redirection Tutorial This tutorial is not a complete guide to redirection, it will not cover here docs, here strings, name pipes etc\... I just hope it\'ll help you @@ -653,7 +663,7 @@ recommendations: ``` - **Never** use the Csh `&>foo` and `>&foo` shorthand redirects. Use - the long form `>foo 2>&1`. (see: [obsolete](../obsolete.md)) + the long form `>foo 2>&1`. (see: [obsolete](../scripting/obsolete.md)) ```{=html} diff --git a/docs/index.md b/docs/index.md index 36be41a..32d9171 100644 --- a/docs/index.md +++ b/docs/index.md @@ -43,17 +43,16 @@ If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - [nonportable](scripting/nonportable.md) - [debuggingtips](scripting/debuggingtips.md) - [terminalcodes](scripting/terminalcodes.md) -- [tutoriallist](scripting/tutoriallist) ## Code snippets -There is a [section that holds small code snippets](snipplets). +There is a [section that holds small code snippets](snipplets/index.md). See also [some Bash source code excerpts](misc/readthesourceluke.md). ## How to -[Doing specific tasks: concepts, methods, ideas](howto/start.md): +Doing specific tasks: concepts, methods, ideas: - [Simple locking (against parallel run.md)](howto/mutex.md) - [Rudimentary config files for your scripts](howto/conffile.md) @@ -164,10 +163,10 @@ These are provided directly by the shell, rather than invoked as standalone exte | Command | Description | Alt | Type | | --------------------------------------------------- | ---------------------------------------------------- | -------- | --------------- | -| [colon](commands/builtin/true.md) | "true" null command. | `true` | special builtin | -| [dot](commands/builtin/source.md) | Source external files. | `source` | special builtin | -| [false](commands/builtin/false.md) | Fail at doing nothing. | | builtin | -| [continue / break](commands/builtin/continueBreak.md) | continue with or break out of loops. | | special builtin | +| `colon` | "true" null command. | `true` | special builtin | +| `.` (dot) | Source external files. | `source` | special builtin | +| `false` | Fail at doing nothing. | | builtin | +| `continue / break` | continue with or break out of loops. | | special builtin | | [let](commands/builtin/let.md) | Arithmetic evaluation simple command. | | builtin | | [return](commands/builtin/return.md) | Return from a function with a specified exit status. | | special builtin | | [[]](commands/classictest.md) | The classic `test` simple command. | `test` | builtin | @@ -183,12 +182,13 @@ These are provided directly by the shell, rather than invoked as standalone exte | [exit](commands/builtin/exit.md) | Exit the shell. | | special builtin | | [trap](commands/builtin/trap.md) | Set signal handlers or output the current handlers. | | special builtin | | [kill](commands/builtin/kill.md) | Send a signal to specified process(es.md) | | builtin | -| [times](commands/builtin/times.md) | Display process times. | | special builtin | +|`times` | Display process times. | | special builtin | | [wait](commands/builtin/wait.md) | Wait for background jobs and asynchronous lists. | | builtin | ## Dictionary -A list of expressions, words, and their meanings is [here](dict/index.md). +A list of expressions, words, and their meanings can be found under the *Dict* +tab. ## Links @@ -253,7 +253,7 @@ Visit us in [ircs://irc.libera.chat:6697](ircs://irc.libera.chat:6697), channel If you have critiques or suggestions, please feel free to send a mail using the contact form on the right. Note that there is a simple discussion option below every article. -Please also see the [imprint](user/thebonsai/imprint.md) if you have problems with the site and its contents (legality, ...)! +Please also see the imprint if you have problems with the site and its contents (legality, ...)! It also would be nice to drop a line when diff --git a/docs/internals/shell_options.md b/docs/internals/shell_options.md index a0611da..50fd0d5 100644 --- a/docs/internals/shell_options.md +++ b/docs/internals/shell_options.md @@ -1,6 +1,15 @@ -# List of shell options +--- +tags: + - bash + - shell + - scripting + - options + - runtime + - variable + - behaviour +--- -![](keywords>bash shell scripting options runtime variable behaviour) +# List of shell options This information was taken from a Bash version \"`4.1`\", every now and then new options are added, so likely, this list isn't complete. diff --git a/docs/scripting/bashbehaviour.md b/docs/scripting/bashbehaviour.md index fa8e846..974274a 100644 --- a/docs/scripting/bashbehaviour.md +++ b/docs/scripting/bashbehaviour.md @@ -1,6 +1,16 @@ -# Bash's behaviour +--- +tags: + - bash + - shell + - scripting + - startup + - files + - dotfiles + - modes + - POSIX +--- -![](keywords>bash shell scripting startup files dotfiles modes POSIX) +# Bash's behaviour FIXME incomplete diff --git a/docs/scripting/basics.md b/docs/scripting/basics.md index 9d7e884..f1f2778 100644 --- a/docs/scripting/basics.md +++ b/docs/scripting/basics.md @@ -1,6 +1,14 @@ -# The basics of shell scripting +--- +tags: + - bash + - shell + - scripting + - basics + - learning + - tutorial +--- -![](keywords>bash shell scripting basics learning tutorial) +# The basics of shell scripting ## Script files diff --git a/docs/scripting/debuggingtips.md b/docs/scripting/debuggingtips.md index b0afe8e..fe25aff 100644 --- a/docs/scripting/debuggingtips.md +++ b/docs/scripting/debuggingtips.md @@ -1,6 +1,14 @@ -# Debugging a script +--- +tags: + - bash + - shell + - scripting + - bug + - debug + - debugging +--- -![](keywords>bash shell scripting bug debug debugging) +# Debugging a script These few lines are not intended as a full-fledged debugging tutorial, but as hints and comments about debugging a Bash script. diff --git a/docs/scripting/newbie_traps.md b/docs/scripting/newbie_traps.md index f5bbcb6..472c664 100644 --- a/docs/scripting/newbie_traps.md +++ b/docs/scripting/newbie_traps.md @@ -1,6 +1,14 @@ -# Beginner Mistakes +--- +tags: + - bash + - shell + - scripting + - pitfalls + - traps + - beginners +--- -![](keywords>bash shell scripting pitfalls traps beginners) +# Beginner Mistakes Here are some typical traps: diff --git a/docs/scripting/nonportable.md b/docs/scripting/nonportable.md index ca2aa6e..0b1e592 100644 --- a/docs/scripting/nonportable.md +++ b/docs/scripting/nonportable.md @@ -1,6 +1,14 @@ -# Portability talk +--- +tags: + - bash + - shell + - scripting + - portability + - POSIX + - portable +--- -![](keywords>bash shell scripting portability POSIX portable) +# Portability talk The script programming language of BASH is based on the Bourne Shell syntax, with some extensions and derivations. diff --git a/docs/scripting/obsolete.md b/docs/scripting/obsolete.md index 9a65c81..11219bd 100644 --- a/docs/scripting/obsolete.md +++ b/docs/scripting/obsolete.md @@ -1,6 +1,14 @@ -# Obsolete and deprecated syntax +--- +tags: + - bash + - shell + - scripting + - obsolete + - deprecated + - outdated +--- -![](keywords>bash shell scripting obsolete deprecated outdated) +# Obsolete and deprecated syntax This (incomplete) page describes some syntax and commands considered obsolete by some measure. A thorough discussion of the rationale is @@ -74,7 +82,7 @@ surprised if you run across someone telling you not to use these. - [Non-portable syntax and command uses](../scripting/nonportable.md) - [bashchanges](../scripting/bashchanges.md) - [Greg's BashFAQ 061: List of essential features added (with the - Bash version tag)](BashFAQ>061) + Bash version tag)](http://mywiki.wooledge.org/BashFAQ/061) - [Bash <-> POSIX Portability guide with a focus on Dash](http://mywiki.wooledge.org/Bashism) - diff --git a/docs/scripting/posparams.md b/docs/scripting/posparams.md index b3cb88a..af495ae 100644 --- a/docs/scripting/posparams.md +++ b/docs/scripting/posparams.md @@ -1,6 +1,15 @@ -# Handling positional parameters +--- +tags: + - bash + - shell + - scripting + - arguments + - positional + - parameters + - options +--- -![](keywords>bash shell scripting arguments positional parameters options) +# Handling positional parameters ## Intro @@ -25,7 +34,7 @@ Option-switch parsing (e.g. `-h` for displaying help) is not performed at this point. See also [the dictionary entry for -\"parameter\"](../dict/terms/parameter.md). +\"parameter\"](../dict/parameter.md). ## The first argument @@ -394,4 +403,4 @@ There is a [small tutorial dedicated to - Internal: [Substring expansion on a parameter](../syntax/pe.md#substring_expansion) (for equivalent syntax for mass-expansion) -- Dictionary, internal: [parameter](../dict/terms/parameter.md) +- Dictionary, internal: [parameter](../dict/parameter.md) diff --git a/docs/scripting/processtree.md b/docs/scripting/processtree.md index 6ece590..cf0d262 100644 --- a/docs/scripting/processtree.md +++ b/docs/scripting/processtree.md @@ -1,6 +1,15 @@ -# Bash and the process tree +--- +tags: + - bash + - shell + - scripting + - processes + - pipes + - variables + - environment +--- -![](keywords>bash shell scripting processes pipes variables environment) +# Bash and the process tree ## The process tree diff --git a/docs/scripting/style.md b/docs/scripting/style.md index ba79222..79b2d38 100644 --- a/docs/scripting/style.md +++ b/docs/scripting/style.md @@ -278,8 +278,8 @@ The basic structure of a script simply reads: ### The shebang -If possible (I know it's not always possible!), use [a -shebang](../dict/terms/shebang.md). +If possible (I know it's not always possible!), use a +[shebang](../dict/interpreter_directive.md). Be careful with `/bin/sh`: The argument that \"on Linux `/bin/sh` is Bash\" **is a lie** (and technically irrelevant) @@ -358,7 +358,7 @@ Example: ### Exit meaningfully -The [exit code](../dict/terms/exit_status.md) is your only way to directly +The [exit code](../dict/exit_status.md) is your only way to directly communicate with the calling process without any special provisions. If your script exits, provide a meaningful exit code. That minimally diff --git a/docs/scripting/terminalcodes.md b/docs/scripting/terminalcodes.md index 991ed85..7eded0d 100644 --- a/docs/scripting/terminalcodes.md +++ b/docs/scripting/terminalcodes.md @@ -1,6 +1,16 @@ -# Terminal codes (ANSI/VT100) introduction +--- +tags: + - bash + - shell + - scripting + - colors + - cursor + - control + - vt100 + - ansi +--- -![](keywords>bash shell scripting colors cursor control vt100 ansi) +# Terminal codes (ANSI/VT100) introduction Terminal (control) codes are used to issue specific commands to your terminal. This can be related to switching colors or positioning the diff --git a/docs/syntax/arith_expr.md b/docs/syntax/arith_expr.md index c683401..f703835 100644 --- a/docs/syntax/arith_expr.md +++ b/docs/syntax/arith_expr.md @@ -1,6 +1,16 @@ -# Arithmetic expressions +--- +tags: + - bash + - shell + - scripting + - math + - arithmetic + - C + - calculation + - integer +--- -![](keywords>bash shell scripting math arithmetic C calculation integer) +# Arithmetic expressions Arithmetic expressions are used in several situations: diff --git a/docs/syntax/basicgrammar.md b/docs/syntax/basicgrammar.md index 5fd8d21..3cc550a 100644 --- a/docs/syntax/basicgrammar.md +++ b/docs/syntax/basicgrammar.md @@ -1,6 +1,14 @@ -# Basic grammar rules of Bash +--- +tags: + - bash + - shell + - scripting + - grammar + - syntax + - language +--- -![](keywords>bash shell scripting grammar syntax language) +# Basic grammar rules of Bash Bash builds its features on top of a few basic **grammar rules**. The code you see everywhere, the code you use, is based on those rules. @@ -55,7 +63,7 @@ name for a construct. Such a pipeline isn't necessarily a pair of commands where stdout/stdin is connected via a real pipe. Pipelines are one or more [simple -commands](basicgrammar##simple_commands) (separated by the `|` symbol +commands](#simple-commands) (separated by the `|` symbol connects their input and output), for example: ls /etc | wc -l @@ -111,7 +119,7 @@ syntax: FIXME Missing an additional article about list operators -A list is a sequence of one or more [pipelines](../basicgrammar.md#pipelines) +A list is a sequence of one or more [pipelines](#pipelines) separated by one of the operators `;`, `&`, `&&`, or `││`, and optionally terminated by one of `;`, `&`, or ``. @@ -168,7 +176,7 @@ overview): FIXME Missing an additional article about shell functions A shell function definition makes a [compound -command](../basicgrammar.md#compound_commands) available via a new name. When +command](#compound_commands) available via a new name. When the function runs, it has its own \"private\" set of positional parameters and I/O descriptors. It acts like a script-within-the-script. Simply stated: **You\'ve created a new command.** @@ -183,7 +191,7 @@ looks like: print_help() { echo "Sorry, no help available"; } As above, a function definition can have any [compound -command](../basicgrammar.md#compound_commands) as a body. Structures like +command](#compound_commands) as a body. Structures like countme() for ((x=1;x<=9;x++)); do echo $x; done @@ -265,17 +273,17 @@ Weird function names should not be used. Quote from the maintainer: ## Grammar summary -- a [simple command](../basicgrammar.md#simple_commands) is just a command +- a [simple command](#simple_commands) is just a command and its arguments -- a [pipeline](../basicgrammar.md#pipelines) is one or more [simple - command](../basicgrammar.md#simple_commands) probably connected in a pipe -- a [list](../basicgrammar.md#lists) is one or more - [pipelines](../basicgrammar.md#pipelines) connected by special operators -- a [compound command](../basicgrammar.md#compound_commands) is a - [list](../basicgrammar.md#lists) or a special command that forms a new +- a [pipeline](#pipelines) is one or more [simple + command](#simple_commands) probably connected in a pipe +- a [list](#lists) is one or more + [pipelines](#pipelines) connected by special operators +- a [compound command](#compound_commands) is a + [list](#lists) or a special command that forms a new meta-command -- a [function definition](../basicgrammar.md#shell_function_definitions) - makes a [compound command](../basicgrammar.md#compound_commands) available +- a [function definition](#shell_function_definitions) + makes a [compound command](#compound_commands) available under a new name, and a separate environment ## Examples for classification @@ -304,12 +312,12 @@ FIXME more\... cp mymusic.mp3 /data/mp3 fi -- the [compound command](../basicgrammar.md#compound_commands) for the `if` +- the [compound command](#compound_commands) for the `if` clause -- the [list](../basicgrammar.md#lists) that `if` **checks** actually - contains the [simple command](../basicgrammar.md#simple_commands) +- the [list](#lists) that `if` **checks** actually + contains the [simple command](#simple_commands) `[ -d /data/mp3 ]` -- the [list](../basicgrammar.md#lists) that `if` **executes** contains a +- the [list](#lists) that `if` **executes** contains a simple command (`cp mymusic.mp3 /data/mp3`) Let's invert test command exit code, only one thing changes: @@ -318,8 +326,8 @@ Let's invert test command exit code, only one thing changes: cp mymusic.mp3 /data/mp3 fi -- the [list](../basicgrammar.md#lists) that `if` **checks** contains a - [pipeline](../basicgrammar.md#pipelines) now (because of the `!`) +- the [list](#lists) that `if` **checks** contains a + [pipeline](#pipelines) now (because of the `!`) ## See also diff --git a/docs/syntax/ccmd/c_for.md b/docs/syntax/ccmd/c_for.md index 1cabd09..5f2e600 100644 --- a/docs/syntax/ccmd/c_for.md +++ b/docs/syntax/ccmd/c_for.md @@ -51,11 +51,11 @@ behaves as if it would be 1 (**TRUE** in arithmetic context). :!: Like all loops (Both types of `for`-loop, `while` and `until`), this loop can be: -- Terminated (broken) by the [break](../../commands/builtin/continuebreak.md) +- Terminated (broken) by the `break` builtin, optionally as `break N` to break out of `N` levels of nested loops. - Forced immediately to the next iteration using the - [continue](../../commands/builtin/continuebreak.md) builtin, optionally as + `continue` builtin, optionally as the `continue N` analog to `break N`. The equivalent construct using a [while loop](../../syntax/ccmd/while_loop.md) @@ -70,7 +70,7 @@ command](../../syntax/ccmd/arithmetic_eval.md) would be structured as: The equivalent `while` construct isn't exactly the same, because both, the `for` and the `while` loop behave differently in case you use the -[continue](../../commands/builtin/continuebreak.md) command. +`continue` command. ### Alternate syntax diff --git a/docs/syntax/ccmd/intro.md b/docs/syntax/ccmd/intro.md index 3919741..6573c32 100644 --- a/docs/syntax/ccmd/intro.md +++ b/docs/syntax/ccmd/intro.md @@ -8,8 +8,8 @@ them. That is what the essential \"Bash language\" is made of. ## Command grouping -- grouping: [command grouping](../../grouping_plain.md) -- grouping again: [command grouping in a subshell](../../grouping_subshell.md) +- grouping: [command grouping](grouping_plain.md) +- grouping again: [command grouping in a subshell](grouping_subshell.md) ## Conditional reactions @@ -18,18 +18,18 @@ Note that conditionals can also be scripted using commands. - the \"new\" test command: [conditional - expression](../../conditional_expression.md) -- if-clause: [conditional branching](../../if_clause.md) -- case statement: [pattern-based branching](../../case.md) + expression](conditional_expression.md) +- if-clause: [conditional branching](if_clause.md) +- case statement: [pattern-based branching](case.md) ## Loops -- [classic for-loop](../../classic_for.md) -- [C-style for-loop](../../c_for.md) -- [while loop](../../while_loop.md) -- [until loop](../../until_loop.md) +- [classic for-loop](classic_for.md) +- [C-style for-loop](c_for.md) +- [while loop](while_loop.md) +- [until loop](until_loop.md) ## Misc -- math: [arithmetic evaluation](../../arithmetic_eval.md) -- menus: [user selections](../../user_select.md) +- math: [arithmetic evaluation](arithmetic_eval.md) +- menus: [user selections](user_select.md) diff --git a/docs/syntax/expansion/brace.md b/docs/syntax/expansion/brace.md index fcc97e5..a4ab5cf 100644 --- a/docs/syntax/expansion/brace.md +++ b/docs/syntax/expansion/brace.md @@ -1,6 +1,16 @@ -# Brace expansion +--- +tags: + - bash + - shell + - scripting + - expansion + - substitution + - text + - list + - brace +--- -![](keywords>bash shell scripting expansion substitution text list brace) +# Brace expansion {string1,string2,...,stringN} {..} diff --git a/docs/syntax/expansion/cmdsubst.md b/docs/syntax/expansion/cmdsubst.md index 7457975..c5334dd 100644 --- a/docs/syntax/expansion/cmdsubst.md +++ b/docs/syntax/expansion/cmdsubst.md @@ -1,6 +1,22 @@ -# Command substitution +--- +tags: + - bash + - shell + - scripting + - expansion + - substitution + - text + - variable + - output + - execute + - stdout + - save + - result + - return + - value +--- -![](keywords>bash shell scripting expansion substitution text variable output execute stdout save result return value) +# Command substitution $( ) diff --git a/docs/syntax/expansion/intro.md b/docs/syntax/expansion/intro.md index cb1e3d4..2e5b2c5 100644 --- a/docs/syntax/expansion/intro.md +++ b/docs/syntax/expansion/intro.md @@ -1,6 +1,18 @@ -# Expansions and substitutions +--- +tags: + - bash + - shell + - scripting + - expansion + - substitution + - text + - variable + - filename + - macro + - wildcard +--- -![](keywords>bash shell scripting expansion substitution text variable filename macro wildcard) +# Expansions and substitutions Before executing your commands, Bash checks whether there are any syntax elements in the command line that should be interpreted rather than diff --git a/docs/syntax/expansion/proc_subst.md b/docs/syntax/expansion/proc_subst.md index 33da05b..0675522 100644 --- a/docs/syntax/expansion/proc_subst.md +++ b/docs/syntax/expansion/proc_subst.md @@ -1,6 +1,18 @@ -# Process substitution +--- +tags: + - bash + - shell + - scripting + - expansion + - substitution + - text + - stdin + - stdout + - save + - capture +--- -![](keywords>bash shell scripting expansion substitution text stdin stdout save capture) +# Process substitution Process substitution is a form of redirection where the input or output of a process (some sequence of commands) appear as a temporary file. @@ -158,7 +170,7 @@ See the above section on [#scope](#scope) not (yet) pdksh derivatives (mksh). Coprocesses may be used instead. - Process substitution is supported only on systems that support either named pipes (FIFO - a [special - file](../../dict/terms/special_file.md)) or the `/dev/fd/*` method for + file](../../dict/special_file.md)) or the `/dev/fd/*` method for accessing open files. If the system doesn't support `/dev/fd/*`, Bash falls back to creating named pipes. Note that not all shells that support process substitution have that fallback. diff --git a/docs/syntax/expansion/tilde.md b/docs/syntax/expansion/tilde.md index 1a872b9..0d4e5eb 100644 --- a/docs/syntax/expansion/tilde.md +++ b/docs/syntax/expansion/tilde.md @@ -1,6 +1,17 @@ -# Tilde expansion +--- +tags: + - bash + - shell + - scripting + - expansion + - substitution + - tilde + - home + - homedir + - shortcut +--- -![](keywords>bash shell scripting expansion substitution tilde home homedir shortcut) +# Tilde expansion ~ ~/... diff --git a/docs/syntax/grammar/parser_exec.md b/docs/syntax/grammar/parser_exec.md index 699c790..72275fb 100644 --- a/docs/syntax/grammar/parser_exec.md +++ b/docs/syntax/grammar/parser_exec.md @@ -1,9 +1,19 @@ +--- +tags: + - bash + - shell + - scripting + - syntax + - language + - behaviour + - executing + - execution +--- + FIXME work in progress\... # Parsing and execution -![](keywords>bash shell scripting syntax language behaviour executing execution) - Nearly everything in [Bash grammar](../../syntax/basicgrammar.md) can be broken down to a \"simple command\". The only thing Bash has to expand, evaluate and execute is the simple command. diff --git a/docs/syntax/pattern.md b/docs/syntax/pattern.md index 3b68b7c..274d8ea 100644 --- a/docs/syntax/pattern.md +++ b/docs/syntax/pattern.md @@ -1,6 +1,17 @@ -# Patterns and pattern matching +--- +tags: + - bash + - shell + - scripting + - glob + - globbing + - wildcards + - filename + - pattern + - matching +--- -![](keywords>bash shell scripting glob globbing wildcards filename pattern matching) +# Patterns and pattern matching A pattern is a **string description**. Bash uses them in various ways: diff --git a/docs/syntax/pe.md b/docs/syntax/pe.md index 33bf607..70d0a32 100644 --- a/docs/syntax/pe.md +++ b/docs/syntax/pe.md @@ -1,6 +1,24 @@ -# Parameter expansion +--- +tags: + - bash + - shell + - scripting + - expansion + - substitution + - text + - variable + - parameter + - mangle + - substitute + - change + - check + - defined + - "null" + - array + - arrays +--- -![](keywords>bash shell scripting expansion substitution text variable parameter mangle substitute change check defined null array arrays) +# Parameter expansion ## Introduction @@ -28,7 +46,7 @@ applicable description mentions arrays below. Please also see the [article about arrays](../syntax/arrays.md). For a more technical view what a parameter is and which types exist, -[see the dictionary entry for \"parameter\"](../dict/terms/parameter.md). +[see the dictionary entry for \"parameter\"](../dict/parameter.md). ## Overview @@ -1053,4 +1071,4 @@ the difference may introduce a possible compatibility problem. - Internal: [Introduction to expansion and substitution](../syntax/expansion/intro.md) - Internal: [Arrays](../syntax/arrays.md) -- Dictionary, internal: [parameter](../dict/terms/parameter.md) +- Dictionary, internal: [parameter](../dict/parameter.md) diff --git a/docs/syntax/quoting.md b/docs/syntax/quoting.md index 6a4f126..c3955c0 100644 --- a/docs/syntax/quoting.md +++ b/docs/syntax/quoting.md @@ -1,6 +1,20 @@ -# Quotes and escaping +--- +tags: + - bash + - shell + - scripting + - quoting + - quotes + - escape + - backslash + - marks + - singlequotes + - doublequotes + - single + - double +--- -![](keywords>bash shell scripting quoting quotes escape backslash marks singlequotes doublequotes single double) +# Quotes and escaping Quoting and escaping are important, as they influence the way Bash acts upon your input. There are three recognized types: diff --git a/docs/syntax/shellvars.md b/docs/syntax/shellvars.md index d1ce263..4b2cdcf 100644 --- a/docs/syntax/shellvars.md +++ b/docs/syntax/shellvars.md @@ -88,8 +88,8 @@ list of aliases as maintained by the alias builtin. Elements added to this array appear in the alias list; unsetting array elements cause aliases to be removed from the alias list. -The associative key is the name of the alias as used with the [alias -builtin command](../commands/builtin/alias.md). +The associative key is the name of the alias as used with the `alias` +builtin command. ### BASH_ARGC @@ -102,8 +102,8 @@ An array variable whose values are the number of parameters in each frame of the current Bash execution call stack. The number of parameters to the current subroutine (shell function or -script executed with [`.` or `source` builtin -command](../commands/builtin/source.md)) is at the top of the stack. When a +script executed with `.` or `source` builtin +command) is at the top of the stack. When a subroutine is executed, the number of parameters passed is pushed onto `BASH_ARGC`. @@ -144,13 +144,13 @@ subsequently reset. Set by Bash: yes Default: n/a An associative array variable whose members correspond to the internal -hash table of commands as maintained by the [hash builtin -command](../commands/builtin/hash.md). Elements added to this array appear in +hash table of commands as maintained by the `hash` builtin +command. Elements added to this array appear in the hash table; unsetting array elements cause commands to be removed from the hash table. -The associative key is the name of the command as used with the[hash -builtin command](../commands/builtin/hash.md). +The associative key is the name of the command as used with the `hash` +builtin command. ### BASH_COMMAND @@ -573,8 +573,8 @@ The previous working directory as set by the cd command. Type: normal variable Read-only: no Set by Bash: yes Default: n/a -The value of the last option argument processed by the [getopts builtin -command](../commands/builtin/getopts.md). +The value of the last option argument processed by the `getopts` builtin +command. ### OPTIND @@ -583,8 +583,8 @@ command](../commands/builtin/getopts.md). Type: integer variable Read-only: no Set by Bash: yes Default: n/a -The index of the next argument to be processed by the [getopts builtin -command](../commands/builtin/getopts.md). +The index of the next argument to be processed by the `getopts` builtin +command. ### OSTYPE @@ -828,7 +828,7 @@ Similar to `BASH_ENV`: Used when the shell is invoked in POSIX(r) mode. Type: normal variable Read-only: no Set by Bash: no Default: n/a -The default editor for the [fc builtin command](../commands/builtin/fc.md). +The default editor for the `fc` builtin command. ### FIGNORE @@ -1177,7 +1177,7 @@ Example content: Set by Bash: yes Default: 1 (set on startup) If set to the value 1, Bash displays error messages generated by the -[getopts builtin command](../commands/builtin/getopts.md). +`getopts` builtin command. `OPTERR` is initialized to 1 each time the shell is invoked or a shell script is executed. @@ -1370,7 +1370,7 @@ A trailing newline is added when the format string is displayed. If set to a value greater than zero, `TMOUT` is treated as the default timeout for the [read builtin command](../commands/builtin/read.md). -The [select command](../commands/builtin/select.md) terminates if input does +The `select` command terminates if input does not arrive after `TMOUT` seconds when input is coming from a terminal. In an interactive shell, the value is interpreted as the number of diff --git a/docs/syntax/words.md b/docs/syntax/words.md index d1018e2..1cbde31 100644 --- a/docs/syntax/words.md +++ b/docs/syntax/words.md @@ -1,6 +1,16 @@ -# Words\... +--- +tags: + - bash + - shell + - scripting + - token + - words + - split + - splitting + - recognition +--- -![](keywords>bash shell scripting token words split splitting recognition) +# Words\... FIXME This article needs a review, it covers two topics (command line splitting and word splitting) and mixes both a bit too much. But in diff --git a/mkdocs.yml b/mkdocs.yml index 023d543..5019b9e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,12 +23,12 @@ theme: repo: fontawesome/brands/github plugins: - - tags: - tags_file: tags.md - git-revision-date-localized: enable_creation_date: true - search - awesome-pages + - tags: + tags_file: tags.md - minify: minify_html: true minify_css: true