-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbash_lesson.sh
executable file
·88 lines (74 loc) · 1.99 KB
/
bash_lesson.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#! /bin/bash
## Bash is learning a new language
## What is a computer?
## What differentiates a server from your laptop?
## What are computers good at?
## What are they not good at?
## How does that play into the ubiquity of command line tools?
## Log into the server:
## If you were making a program to log people onto a remote server
## what would you need to know to do that?
## Anatomy of a command
## command - ssh
## argument - [email protected]
## Sometimes commands don't need arguments.
cal
pwd
echo
## And most of the time the arguments are optional
echo Hello World!
## What does echo do?
## How many arguments?
## what will the output of:
echo Hello World!
## look like? Why?
cal
cal -3j
cal -j3
#What is weird about 1752? How can you tell?
man cal
whatis cal
## google "bash cal"
## Let's talk about paths!
## Folders and files
## What is the structure like? Tree analogy
## root, relative vs absolute paths
## When should you use which?
tree
## Where are we?
## . .. ~ -
pwd
cd
cd example_assembly
## Where are you know?
## What are some ways you could get back to your home directory?
## How about to the example reads directory?
ls -lah
## what are the options? What does ls do?
## Move copy and delete:
cd
mkdir sandbox
cd sandbox
cp -r ~/example_assembly .
cd example_assembly
ls -lh
mv quast_report/report.txt .
less report.txt
## That's lame, let's spruce those results up a bit!
nano report.txt
head report.txt
## What's the opposite of head?
tail report.txt
tail -20 report.txt
## What advantages does less have over editors like nano?
grep l report.txt
grep -i l report.txt
grep -v l report.txt
cd ../prokka_report
grep -v hypothetical *.faa
grep -v hypothetical *.faa | grep ">" | less ## quotes are very important!!!
## anyone got a favorite protein?
## Rant about scripting and reproducibility of results...
## That was generic and "relatively" unchanged since the dawn of time (1980s)
## The rest is not, and will probably change lots.