Skip to content

Commit b90f3aa

Browse files
committed
added redirection
1 parent 7aeef29 commit b90f3aa

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

.github/workflows/mergeFiles.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Merge MD Files
2020
run: |
2121
# Define the order of markdown files to merge
22-
files_to_merge=("index.md", "navigation.md", "files.md", "ssh.md", "sed.md", "grep.md", "searchingFiles.md", "netstat.md", "lsof.md", "curl.md", "wget.md")
22+
files_to_merge=("index.md", "navigation.md", "files.md", "ssh.md", "sed.md", "grep.md", "searchingFiles.md", "netstat.md", "lsof.md", "curl.md", "wget.md", "redirection.md")
2323
# remove existing contents readme
2424
echo '' > README.md
2525
# Merge files in the specified order

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020

2121

2222
### Stuff you should to Know
23-
1. [Redirection](#REDIRECTION)
23+
1. [Redirection](#redirection)
2424
2. [Process Substitution](#PROCESS_SUBSTITUTION)
2525
3. [Bash Fu](#BASHFU)

redirection.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Redirection
2+
3+
> Redirect output to stdin of another command using `>` and to redirect standard input, we use `<`.
4+
```shell
5+
cat file.txt > file2.txt
6+
cat < file.txt
7+
# redirect stderr
8+
find / 2> /dev/null
9+
# redirect stdout and stderr
10+
find / 2> /dev/null 2>&1
11+
```
12+
13+
> To redirect output of one command to input of another, we use piping `|`.
14+
```shell
15+
ls / | grep root
16+
```
17+
* We cannot do this using `>` because, it writes to a file descriptor and `grep` takes in a file descriptor to read from. To make it work, we may use process substitution.

0 commit comments

Comments
 (0)