Skip to content
Snippets Groups Projects
Commit e472931b authored by jacques.dainat_ird.fr's avatar jacques.dainat_ird.fr
Browse files

externalize setup folder structure

parent 6e91f932
No related branches found
No related tags found
No related merge requests found
Pipeline #2534 failed
### 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.
......@@ -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.
......
......@@ -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?
......
# 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
```
![](../images/3-navigation/tree_exo5.png){: style="height:250px"}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment