From 756c89cfd7db6e08ab3245a0b74a38020ac0a63a Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:43:28 -0600 Subject: [PATCH 01/13] vault backup: 2024-05-30 17:43:28 --- IT/Scripting.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 5598dfa..0ddc012 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -6,4 +6,5 @@ There are various shells with their own language syntax (`sh`, `bash`, `fish`, e ```sh #!/bin/sh echo "Hello, World!" -``` \ No newline at end of file +``` +`#!/bin/sh` means that this script can be executed by the binary located at `/bin/sh`, and so the reader knows this is a `sh`(ell) script. \ No newline at end of file From 4b336dca708504240ed60f2934328b9ef37bd725 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:45:46 -0600 Subject: [PATCH 02/13] vault backup: 2024-05-30 17:45:46 --- IT/Scripting.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 0ddc012..86bcb42 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -7,4 +7,5 @@ There are various shells with their own language syntax (`sh`, `bash`, `fish`, e #!/bin/sh echo "Hello, World!" ``` -`#!/bin/sh` means that this script can be executed by the binary located at `/bin/sh`, and so the reader knows this is a `sh`(ell) script. \ No newline at end of file +`#!/bin/sh` means that this script can be executed by the binary located at `/bin/sh`, and so the reader knows this is a `sh`(ell) script. + From 2b7c23d782e5cded466a6880d6859fc648066a3c Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:46:46 -0600 Subject: [PATCH 03/13] vault backup: 2024-05-30 17:46:46 --- IT/Scripting.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 86bcb42..a39f5d7 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -1,7 +1,7 @@ ## Marking a script as executable Sometimes, you may need to mark a script as an executable to run it. On Linux, this can be accomplished by `chmod +x [FILE]`, where `[FILE]` is the file you want to mark as executable. To unmark a file as executable, use `chmod -x` -## The shebang +## The Shebang There are various shells with their own language syntax (`sh`, `bash`, `fish`, etc). Therefore, more complicated scripts will indicate a particular shell by specifying the absolute path to the interpreter as the first line, prefixed by `#!` like this: ```sh #!/bin/sh @@ -9,3 +9,5 @@ echo "Hello, World!" ``` `#!/bin/sh` means that this script can be executed by the binary located at `/bin/sh`, and so the reader knows this is a `sh`(ell) script. +## Variables +In bash, variable assignment is done with the `=` operat \ No newline at end of file From 9bdbc4da232e78fd961dd6853c003bebf9640f61 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:47:46 -0600 Subject: [PATCH 04/13] vault backup: 2024-05-30 17:47:46 --- IT/Scripting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index a39f5d7..60a5b90 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -10,4 +10,4 @@ echo "Hello, World!" `#!/bin/sh` means that this script can be executed by the binary located at `/bin/sh`, and so the reader knows this is a `sh`(ell) script. ## Variables -In bash, variable assignment is done with the `=` operat \ No newline at end of file +In bash, variable assignment is done with the `=` operator. Variables are conventionally named with `SCREAMING_SNAKE_CASE`, and can be accessed by prefixing the variable name with a dollar sign () \ No newline at end of file From aa41e0d49233de2d86c7a0840db18c4a01377ff7 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:48:46 -0600 Subject: [PATCH 05/13] vault backup: 2024-05-30 17:48:46 --- IT/Scripting.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 60a5b90..1178f03 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -10,4 +10,11 @@ echo "Hello, World!" `#!/bin/sh` means that this script can be executed by the binary located at `/bin/sh`, and so the reader knows this is a `sh`(ell) script. ## Variables -In bash, variable assignment is done with the `=` operator. Variables are conventionally named with `SCREAMING_SNAKE_CASE`, and can be accessed by prefixing the variable name with a dollar sign () \ No newline at end of file +In bash, variable assignment is done with the `=` operator. Variables are conventionally named with `SCREAMING_SNAKE_CASE`, and can be accessed by prefixing the variable name with a dollar sign (`$`): +```bash +#!/bin/bash +# There may not be any spaces +# Assignment is done with the equal sign (=) operator: +MY_VARIABLE=" + +``` \ No newline at end of file From f1929b060e4ee3009abe4e5c56ea56a7e11647db Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:49:46 -0600 Subject: [PATCH 06/13] vault backup: 2024-05-30 17:49:46 --- IT/Scripting.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 1178f03..bf6a0ac 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -13,8 +13,8 @@ echo "Hello, World!" In bash, variable assignment is done with the `=` operator. Variables are conventionally named with `SCREAMING_SNAKE_CASE`, and can be accessed by prefixing the variable name with a dollar sign (`$`): ```bash #!/bin/bash -# There may not be any spaces +# There may not be any spaces used during assignment, `A = B` means something different than `A=B` # Assignment is done with the equal sign (=) operator: -MY_VARIABLE=" - +MY_VARIABLE="Hi Mom!" +echo $MY_VARIABLE ``` \ No newline at end of file From e2c4aa22a7bb8740f5fa233bfb401561a4e69e02 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:50:46 -0600 Subject: [PATCH 07/13] vault backup: 2024-05-30 17:50:46 --- IT/Scripting.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index bf6a0ac..4afab8a 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -17,4 +17,7 @@ In bash, variable assignment is done with the `=` operator. Variables are conven # Assignment is done with the equal sign (=) operator: MY_VARIABLE="Hi Mom!" echo $MY_VARIABLE -``` \ No newline at end of file +``` + + +## Operators From c468195f914dbfdca50e2a1a59c3d226e91daab7 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:51:46 -0600 Subject: [PATCH 08/13] vault backup: 2024-05-30 17:51:46 --- IT/Scripting.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 4afab8a..9e89959 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -20,4 +20,7 @@ echo $MY_VARIABLE ``` -## Operators +## Commands +| Command | Description | +| ------------- | ---------------------------------------------------- | +| `exit [CODE]` | Make the script process exit with exit code `[CODE]` | \ No newline at end of file From 6434f9be6c24f200d13a6756103f158d9873de7d Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:52:46 -0600 Subject: [PATCH 09/13] vault backup: 2024-05-30 17:52:46 --- IT/Scripting.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 9e89959..848c14a 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -19,8 +19,12 @@ MY_VARIABLE="Hi Mom!" echo $MY_VARIABLE ``` +## Quotes +In Bash, different styles of quotes mean different things: + ## Commands -| Command | Description | -| ------------- | ---------------------------------------------------- | -| `exit [CODE]` | Make the script process exit with exit code `[CODE]` | \ No newline at end of file +| Command | Description | +| ------------- | ---------------------------------------------------------------------------------------------- | +| `exit [CODE]` | Make the script process exit, where `[CODE]` is the exit code the process will terminate with. | +| | | \ No newline at end of file From cb3973016c7380bac9408cd86eb8cb03db0be0f2 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:53:46 -0600 Subject: [PATCH 10/13] vault backup: 2024-05-30 17:53:46 --- IT/Scripting.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 848c14a..718eaf0 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -22,7 +22,9 @@ echo $MY_VARIABLE ## Quotes In Bash, different styles of quotes mean different things: - +| Quote | Description | +| ----- | ----------- | +| | | ## Commands | Command | Description | | ------------- | ---------------------------------------------------------------------------------------------- | From 885a27ebd94b347cc841bf585f6721dfe5966ac3 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:54:46 -0600 Subject: [PATCH 11/13] vault backup: 2024-05-30 17:54:46 --- IT/Scripting.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 718eaf0..0e777ae 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -22,9 +22,11 @@ echo $MY_VARIABLE ## Quotes In Bash, different styles of quotes mean different things: -| Quote | Description | -| ----- | ----------- | -| | | +| Quote | Description | +| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Single Quotes (') | Enclosing characters in single quotes (‘'’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash. Commands in single quotes will not be evaluated. | +| Double Quotes (") | Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’. When the shell is in POSIX mode (see [Bash POSIX Mode](https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html)), the ‘!’ has no special meaning within double quotes, even when history expansion is enabled. The characters ‘$’ and ‘`’ retain their special meaning within double quotes (see [Shell Expansions](https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html)). The backslash retains its special meaning only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or `newline`. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ‘!’ appearing in double quotes is escaped using a backslash. The backslash preceding the ‘!’ is not removed. | +| | | ## Commands | Command | Description | | ------------- | ---------------------------------------------------------------------------------------------- | From f7e3f8737bca63588e95079932cfda9d654ed759 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:55:46 -0600 Subject: [PATCH 12/13] vault backup: 2024-05-30 17:55:46 --- IT/Scripting.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 0e777ae..809bf1c 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -22,11 +22,11 @@ echo $MY_VARIABLE ## Quotes In Bash, different styles of quotes mean different things: -| Quote | Description | -| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Single Quotes (') | Enclosing characters in single quotes (‘'’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash. Commands in single quotes will not be evaluated. | -| Double Quotes (") | Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’. When the shell is in POSIX mode (see [Bash POSIX Mode](https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html)), the ‘!’ has no special meaning within double quotes, even when history expansion is enabled. The characters ‘$’ and ‘`’ retain their special meaning within double quotes (see [Shell Expansions](https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html)). The backslash retains its special meaning only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or `newline`. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ‘!’ appearing in double quotes is escaped using a backslash. The backslash preceding the ‘!’ is not removed. | -| | | +| Quote | Description | +| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Single Quotes (') | Enclosing characters in single quotes (`'`) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash. Commands in single quotes will not be evaluated. | +| Double Quotes (") | Enclosing characters in double quotes (`"`) preserves the literal value of all characters within the quotes, with the exception of `$`, ‘\`’, ‘\’, and, when history expansion is enabled, ‘!’. When the shell is in POSIX mode (see Bash POSIX Mode), the ‘!’ has no special meaning within double quotes, even when history expansion is enabled. The characters ‘$’ and ‘`’ retain their special meaning within double quotes (see Shell Expansions). The backslash retains its special meaning only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or newline. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ‘!’ appearing in double quotes is escaped using a backslash. The backslash preceding the ‘!’ is not removed. | +| | | ## Commands | Command | Description | | ------------- | ---------------------------------------------------------------------------------------------- | From 1194f1c9333225325e964655214e307635d1f1f0 Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 17:56:46 -0600 Subject: [PATCH 13/13] vault backup: 2024-05-30 17:56:46 --- IT/Scripting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IT/Scripting.md b/IT/Scripting.md index 809bf1c..0752772 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -25,7 +25,7 @@ In Bash, different styles of quotes mean different things: | Quote | Description | | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Single Quotes (') | Enclosing characters in single quotes (`'`) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash. Commands in single quotes will not be evaluated. | -| Double Quotes (") | Enclosing characters in double quotes (`"`) preserves the literal value of all characters within the quotes, with the exception of `$`, ‘\`’, ‘\’, and, when history expansion is enabled, ‘!’. When the shell is in POSIX mode (see Bash POSIX Mode), the ‘!’ has no special meaning within double quotes, even when history expansion is enabled. The characters ‘$’ and ‘`’ retain their special meaning within double quotes (see Shell Expansions). The backslash retains its special meaning only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or newline. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ‘!’ appearing in double quotes is escaped using a backslash. The backslash preceding the ‘!’ is not removed. | +| Double Quotes (") | Enclosing characters in double quotes (`"`) preserves the literal value of all characters within the quotes, with the exception of `$`, `\`` `\\`, and, when history expansion is enabled, ‘!’. When the shell is in POSIX mode (see Bash POSIX Mode), the ‘!’ has no special meaning within double quotes, even when history expansion is enabled. The characters ‘$’ and ‘`’ retain their special meaning within double quotes (see Shell Expansions). The backslash retains its special meaning only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or newline. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ‘!’ appearing in double quotes is escaped using a backslash. The backslash preceding the ‘!’ is not removed. | | | | ## Commands | Command | Description |