diff --git a/docs/pages/bash/bash-0-setup.md b/docs/pages/bash/bash-0-setup.md new file mode 100644 index 0000000000000000000000000000000000000000..76a12151d0dca9beee6326ab066b6ae50fd284bb --- /dev/null +++ b/docs/pages/bash/bash-0-setup.md @@ -0,0 +1,19 @@ +### Setup + + +First copy and paste this command to execute it. No worries not need to understand what it does. + +```bash +course={{extra.working_directory}} +mkdir -p ~/$course/script +mkdir -p ~/$course/data +echo "Welcome to the {{extra.working_directory}} course" > ~/$course/README +echo "echo hello" > ~/$course/script/script1.sh +echo "ATGC" > ~/$course/data/data1.fa +touch ~/$course/data/dataA.fastq +touch ~/$course/data/dataB.fastq +cd $course +echo "done" +``` + +The command above prepare a {{extra.working_directory}} directory with material. diff --git a/docs/pages/bash/bash-2-the-basics.md b/docs/pages/bash/bash-2-the-basics.md index 65386d0d1068e9af1c19a09ee4c14ac42807cf95..c487975d7e6b5ef70b818e94e054169041a2138f 100644 --- a/docs/pages/bash/bash-2-the-basics.md +++ b/docs/pages/bash/bash-2-the-basics.md @@ -71,6 +71,10 @@ Bash is often preferred over other shells for many reasons: ## The Unix directory structure +{% + include-markdown "pages/bash/bash-0-setup.md" +%} + **/ – The root directory** Everything, all the files and directories, in Linux are located under `root` represented by `/`. If you look at the directory structure, you’ll realize that it is similar to a plant’s root. diff --git a/docs/pages/bash/bash-3-navigating.md b/docs/pages/bash/bash-3-navigating.md index 14294946feeb66a0828f6b001464a238598bcbf0..c0097fb114c7f90e70a79cdbf9078ac07c74df88 100644 --- a/docs/pages/bash/bash-3-navigating.md +++ b/docs/pages/bash/bash-3-navigating.md @@ -2,25 +2,11 @@ Back to the directory structure... this time we will learn to `navigate between directories` and the difference between **absolute** and **relative** paths. -## Prepare +??? quote "First click and follow the instructions below only if you start the course at this stage! Otherwise skip this step!" + {% + include-markdown "pages/bash/bash-0-setup.md" + %} -Back to the directory structure... this time we will learn difference between **absolute** and **relative** path and use a few commands in process. - -First copy and paste this command to execute it. No worries not need to understand what it does. - -```bash -course={{extra.working_directory}} -mkdir -p ~/$course/script -mkdir -p ~/$course/data -echo "Welcome to the {{extra.working_directory}} course" > ~/$course/README -echo "echo hello" > ~/$course/script/script1.sh -echo "ATGC" > ~/$course/data/data1.fa -touch ~/$course/data/dataA.fastq -touch ~/$course/data/dataB.fastq -echo "done" -``` - -The command above prepare a {{extra.working_directory}} directory with material. ## Where are we? @@ -121,7 +107,7 @@ To move into a directory we have seen we can use the command `cd` and a director ## Relative path -A `relative`` path is a path that specifies the location of a file or directory with respect to the current working directory. Any path that does not begin with a separator character ("/") is a relative path. +A `relative` path is a path that specifies the location of a file or directory with respect to the current working directory. Any path that does not begin with a separator character ("/") is a relative path. !!! tip Relative path: @@ -190,12 +176,15 @@ We are now in the `script` directory. 1. cd . 2. cd .. 3. cd ../.. - 4. cd /home/<userName> + 4. cd /home/<userName\> 5. cd ~ 6. cd home 7. cd ~/data/.. 9. cd / +??? example "Click to show the solution" + 3,4,5 + ## File path Autocompletion It exist a wonderful behavior in Bash called the autocompletion. What it is? diff --git a/docs/pages/bash/bash-4-working_with_files_and_directories.md b/docs/pages/bash/bash-4-working_with_files_and_directories.md index 4f63def3bcb88a109a199bf60ad183cdf42f800d..f987b4845ea216915d5abb3cdd8c344152fc79e7 100644 --- a/docs/pages/bash/bash-4-working_with_files_and_directories.md +++ b/docs/pages/bash/bash-4-working_with_files_and_directories.md @@ -1,7 +1,14 @@ # Working with files and directories -In theory you should be in the `script` directory. -Check using `pwd` and if it is not the case run `cd ~/{{extra.working_directory}}/script` +??? quote "First click and follow the instructions below only if you start the course at this stage! Otherwise skip this step!" + {% + include-markdown "pages/bash/bash-0-setup.md" + %} + +Let's be sure to be in the `script` directory before to continue the rest of the training: +```bash +cd ~/{{extra.working_directory}}/script +``` {: style="height:250px"}