1
0
Fork 0
mirror of https://codeberg.org/Mo8it/How_To_Linux.git synced 2024-11-24 23:21:35 +00:00

Move shell scripting to day 4

This commit is contained in:
Mo 2023-08-15 00:47:09 +02:00
parent 7d8e66b722
commit 55bf9ed17b
2 changed files with 4 additions and 4 deletions

View file

@ -11,12 +11,12 @@
<!-- <!--
- [Day 2](day_2/README.md) - [Day 2](day_2/README.md)
- [Shell glue](day_2/glue.md) - [Shell glue](day_2/glue.md)
- [Shell scripting](day_2/shell_scripting.md)
- [Tasks](day_2/tasks.md) - [Tasks](day_2/tasks.md)
- [Day 3](day_3/README.md) - [Day 3](day_3/README.md)
- [Notes](day_3/notes.md) - [Notes](day_3/notes.md)
- [Tasks](day_3/tasks.md) - [Tasks](day_3/tasks.md)
- [Day 4](day_4/README.md) - [Day 4](day_4/README.md)
- [Shell scripting](day_4/shell_scripting.md)
- [Notes](day_4/notes.md) - [Notes](day_4/notes.md)
- [Tasks](day_4/tasks.md) - [Tasks](day_4/tasks.md)
- [Day 5](day_5/README.md) - [Day 5](day_5/README.md)

View file

@ -41,11 +41,11 @@ If you don't choose Linux, you get the output "Nah, that can't be right! (...)".
We did learn that we can redirect to a file using `>`. The syntax `1>&2` redirects the standard output to the standard error. On the other hand. `2>&1` redirects the standard error to the standard output. We did learn that we can redirect to a file using `>`. The syntax `1>&2` redirects the standard output to the standard error. On the other hand. `2>&1` redirects the standard error to the standard output.
If you want to redirect both the standard output and error to a file, you can use this syntax: `COMMAND > FILE 2>&1`. If you want to redirect both the standard output and error to a file, you can use this syntax: `COMMAND >FILE 2>&1`.
The redirection **order** is important in this case! `COMMAND 2>&1 > FILE` will redirect the standard output **only** to the file `FILE`! The redirection **order** is important in this case! `COMMAND 2>&1 >FILE` will redirect the standard output **only** to the file `FILE`!
`COMMAND > FILE 2>&1` has a useful shortcut: `COMMAND &> FILE`. You can also use `&>>` to append. `COMMAND >FILE 2>&1` has a useful shortcut: `COMMAND &>FILE`. You can also use `&>>` to append.
All other aspects of the script above will be explained in the next sections. All other aspects of the script above will be explained in the next sections.