You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bash2.qmd
+15-30Lines changed: 15 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Bash Unit 2
3
3
subtitle: Files and file systems
4
-
execute:
4
+
execute:
5
5
enabled: false
6
6
---
7
7
@@ -174,41 +174,22 @@ You may be used to a workflow where you first copy a file (e.g., Ctrl+C), then g
174
174
Copy the file `gRNAs.txt` from your home directory into the directory `day2`. Then rename the copied file in this directory to `gRNAs_exercise.txt`.
175
175
176
176
177
-
## Editing in nano
177
+
## Editing in fresh
178
178
179
-
Now add a line at the end of the file `gRNAs.txt` that is located in your home directory, adding the gRNA sequence "ACTGACTG". Use the `nano` editor for this purpose. To quit the nano-editor you need to press Ctrl+X. Then type y+Enter to save the changes. Nano commands are shown in the editor and can be found on the internet. A list is provided below.
180
-
181
-
Nano commands:
182
-
183
-
Command | Function
184
-
--- | ---
185
-
ctrl+r | read/insert file
186
-
ctrl+o | save file
187
-
ctrl+x | close file
188
-
alt+a | start selecting text
189
-
ctrl+k | cut selection
190
-
ctrl+u | uncut (paste) selection
191
-
alt+/ | go to end of the file
192
-
ctrl+a | go to start of the line
193
-
ctrl+e | go to end of the line
194
-
ctrl+c | show line number
195
-
ctrl+_ | go to line number
196
-
ctrl+w | find matching word
197
-
alt+w | find next match
198
-
ctrl+\ | find and replace
179
+
Now add a line at the end of the file `gRNAs.txt` that is located in your home directory, adding the gRNA sequence "ACTGACTG". Use the [`fresh` editor](https://getfresh.dev/) for this purpose. Save your changes with Ctrl+S and quit the editor with Ctrl+Q.
199
180
200
181
```bash
201
-
nano gRNAs.txt
182
+
fresh gRNAs.txt
202
183
```
203
184
204
-
Now use nano to modify the shell to make things prettier. To do so change the file `.bash_profile`. This file contains settings for each user (the naming is just by convention). It starts with a `.`, which for Linux means the file is hidden.
185
+
Now use fresh to modify the shell to make things prettier. To do so change the file `.bash_profile`. This file contains settings for each user (the naming is just by convention). It starts with a `.`, which for Linux means the file is hidden.
205
186
206
187
```bash
207
-
nano~/.bash_profile
208
-
# This creates the file and also opens it in nano
188
+
fresh~/.bash_profile
189
+
# This creates the file and also opens it in fresh
209
190
```
210
191
211
-
Add the following lines to `.bash_profile` in nano, then exit the file and save it - see the commands above.
192
+
Add the following lines to `.bash_profile` in fresh, then exit the file and save it - see the commands above.
212
193
213
194
::: {.callout-tip}
214
195
In Windows PowerShell, copy/paste works best if you enable the option to do so via Ctrl+Shift+V, as shown below.
@@ -238,10 +219,14 @@ ls -l
238
219
ls -al
239
220
```
240
221
241
-
::: {.callout-tip}
222
+
::: {.callout-important}
242
223
If your grade sheet does not show that the content of .bash_profile is correct but it still works, then leave it. There may be a small difference in between your version and the expected one that does not impact the functionality.
243
224
:::
244
225
226
+
::: {.callout-tip}
227
+
An older, but still very popular alternative to the fresh editor is [`nano`](https://www.nano-editor.org/). However, since fresh has a more intuitive user interface, we use the latter editor in this course.
To make sure you have the entire file properly downloaded, compare the MD5 hash of the file. MD5 hash functions are a compact digital fingerprint of a file. The MD5 hash of the file should be `b16d46bf09c3b8b7909624f1e6c414ce`.
Copy file name to clipboardExpand all lines: bash4.qmd
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ Operator | Description | Example
74
74
`-ge` | Checks if the value of left operand is greater than or equal to the value of right operand; if yes, then the condition becomes true. | `[ $a -ge $b ]` is not true.
75
75
`-le` | Checks if the value of left operand is less than or equal to the value of right operand; if yes, then the condition becomes true. | `[ $a -le $b ]` is true.
76
76
77
-
You can also use nano to write the code above into a file (for example here: `script.sh`) and then use the following to execute it:
77
+
You can also use fresh/nano to write the code above into a file (for example here: `script.sh`) and then use the following to execute it:
Copy file name to clipboardExpand all lines: python1.qmd
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -30,15 +30,15 @@ print("Hello from the interactive shell")
30
30
```
31
31
32
32
Script mode
33
-
: Write Python commands into a text file (e.g., by using nano to create a file `my_program.py`). If you are still in the interactive mode: exit the python console by typing `exit()` or the key combination `Ctrl-D` (`Ctrl` is `Strg` on a German keyboard), then open and edit the file in a text editor such as nano.
33
+
: Write Python commands into a text file (e.g., by using fresh/nano to create a file `my_program.py`). If you are still in the interactive mode: exit the python console by typing `exit()` or the key combination `Ctrl-D` (`Ctrl` is `Strg` on a German keyboard), then open and edit the file in a text editor such as fresh/nano.
34
34
```bash
35
-
nano my_program.py
35
+
nano my_program.py# or: fresh my_program.py
36
36
```
37
37
Then enter python code into the file.
38
38
```python
39
39
print("Hello from the python script")
40
40
```
41
-
Then, exit nano to get back to the bash shell and pass the name of this file to the `python` command as argument:
41
+
Then, exit fresh/nano to get back to the bash shell and pass the name of this file to the `python` command as argument:
0 commit comments