<commit_before>= Shell

== Introduction
A shell (also called a terminal or a command line interface) permits to invoke programs by typing commands.
* Under Linux, use BASH (Bourne-again Shell), for example.
* Under Windows, use https://docs.microsoft.com/powershell/scripting/install/installing-windows-powershell[PowerShell], or Git BASH, which emulates a Linux shell.
* (Different shells admit slightly different syntax and provide slightly different capabilities, and commands sometimes differ, but the commands we will need for this course are the same in most classical shells, except when indicated.)

See https://tutorial.djangogirls.org/en/intro_to_command_line/[Introduction to command line] for the very basics of using a shell. Use ↑ (keyboard up https://en.wikipedia.org/wiki/Arrow_keys[arrow]) to reuse previous commands. https://www.lamsade.dauphine.fr/~bnegrevergne/ens/Unix/static/TP_Shell_Unix.pdf[This tutorial] could help as well.

[[Arguments]]
== About arguments
A shell command contains (typically) a program name, followed by arguments, separated by spaces. Example: `touch afile anotherfile` calls the program `touch` with two arguments. (This command creates two empty files, `afile` and `anotherfile`, if they do not exist already.) Any argument can be surrounded by quotes, it does not change anything, thus, the commands `touch "afile" "anotherfile"` or `touch "afile" anotherfile` are equivalent to the previous one. To form a single argument containing spaces, quotes are mandatory. Example: `touch "a file" "another file"` contains two arguments: `a file` and `another file`. Thus, this command creates two files, named `a file` and `another file`, with spaces in their names. The command `touch a file another file` (without quotes) would instead create four files. 

Exercice: open a shell, navigate (using `cd`) to some different place of your choice on your hard disk, create a file `my file.txt` there, delete it with your graphical file explorer, check in the terminal that it has disappeared (using `ls`).

Here are other examples for better understanding what an argument is: the command `ls -a` has one argument, `-a`. It is equivalent to `ls "-a"`. The command `ls --color=always "a file"` has two arguments. It is equivalent to `ls "--color=always" "a file"`. The https://git-scm.com/docs/git-config[command] `git config --type bool --get core.filemode` has five arguments (considering `git` as the command and `config` as its first argument).

[[Paths]]
== Relative and absolute paths
It is often necessary to refer to files or directories as arguments to commands in the terminal. You do this usually by using absolute or relative file or directory paths.

A file or a directory stored on your hard disk has an absolute “path” (or, less technically, “name”) that refers to it unambiguously. For example, under Linux (or MacOS): `/home/user2/statusReport`; and under Windows: `C:\Documents\myprojectdirectory\README.txt`. (Windows uses backslashes instead of slashes to separate path names and a slightly different naming scheme.) Examples in this course follow the Linux-like naming.

The term “path” comes from the fact that this way of referring to files correspond to following a path in a tree that represents the hierarchy of files on your file system. In the file system displayed below (from https://docs.oracle.com/javase/tutorial/essential/io/path.html[Oracle tutorial]), a file has the path `/home/user1/foo`, for example.
<commit_msg>Fmt again<commit_after>= Shell

== Introduction
A shell (also called a terminal or a command line interface) permits to invoke programs by typing commands.

* Under Linux, use BASH (Bourne-again Shell), for example.
* Under Windows, use https://docs.microsoft.com/powershell/scripting/install/installing-windows-powershell[PowerShell], or Git BASH, which emulates a Linux shell.
* (Different shells admit slightly different syntax and provide slightly different capabilities, and commands sometimes differ, but the commands we will need for this course are the same in most classical shells, except when indicated.)

See https://tutorial.djangogirls.org/en/intro_to_command_line/[Introduction to command line] for the very basics of using a shell. Use ↑ (keyboard up https://en.wikipedia.org/wiki/Arrow_keys[arrow]) to reuse previous commands. https://www.lamsade.dauphine.fr/~bnegrevergne/ens/Unix/static/TP_Shell_Unix.pdf[This tutorial] could help as well.

[[Arguments]]
== About arguments
A shell command contains (typically) a program name, followed by arguments, separated by spaces. Example: `touch afile anotherfile` calls the program `touch` with two arguments. (This command creates two empty files, `afile` and `anotherfile`, if they do not exist already.) Any argument can be surrounded by quotes, it does not change anything, thus, the commands `touch "afile" "anotherfile"` or `touch "afile" anotherfile` are equivalent to the previous one. To form a single argument containing spaces, quotes are mandatory. Example: `touch "a file" "another file"` contains two arguments: `a file` and `another file`. Thus, this command creates two files, named `a file` and `another file`, with spaces in their names. The command `touch a file another file` (without quotes) would instead create four files. 

Exercice: open a shell, navigate (using `cd`) to some different place of your choice on your hard disk, create a file `my file.txt` there, delete it with your graphical file explorer, check in the terminal that it has disappeared (using `ls`).

Here are other examples for better understanding what an argument is: the command `ls -a` has one argument, `-a`. It is equivalent to `ls "-a"`. The command `ls --color=always "a file"` has two arguments. It is equivalent to `ls "--color=always" "a file"`. The https://git-scm.com/docs/git-config[command] `git config --type bool --get core.filemode` has five arguments (considering `git` as the command and `config` as its first argument).

[[Paths]]
== Relative and absolute paths
It is often necessary to refer to files or directories as arguments to commands in the terminal. You do this usually by using absolute or relative file or directory paths.

A file or a directory stored on your hard disk has an absolute “path” (or, less technically, “name”) that refers to it unambiguously. For example, under Linux (or MacOS): `/home/user2/statusReport`; and under Windows: `C:\Documents\myprojectdirectory\README.txt`. (Windows uses backslashes instead of slashes to separate path names and a slightly different naming scheme.) Examples in this course follow the Linux-like naming.

The term “path” comes from the fact that this way of referring to files correspond to following a path in a tree that represents the hierarchy of files on your file system. In the file system displayed below (from https://docs.oracle.com/javase/tutorial/essential/io/path.html[Oracle tutorial]), a file has the path `/home/user1/foo`, for example.

{'fraction_non_alphanumeric': 0.08315412186379928, 'fraction_numerical': 0.0005734767025089606, 'mean_word_length': 4.837656903765691, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5157032', 'n_tokens_mistral': 1816, 'n_tokens_neox': 1747, 'n_words': 953}