Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<, >, |, $: add page #13846

Merged
merged 29 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
eedc6be
Create >.md
Managor Sep 26, 2024
63fceff
Update >.md
Managor Sep 26, 2024
cb9547c
Update >.md
Managor Sep 26, 2024
3637365
Update >.md
Managor Sep 26, 2024
d9565ec
Create <.md
Managor Sep 26, 2024
eb8256a
Update <.md
Managor Sep 26, 2024
f3f32f5
Create |.md
Managor Sep 26, 2024
26a3329
Create $.md
Managor Sep 26, 2024
254dedd
Update $.md
Managor Sep 26, 2024
d9cdbbc
Update <.md
Managor Sep 26, 2024
140be27
Update <.md
Managor Sep 26, 2024
4ba532b
Update $.md
Managor Sep 26, 2024
ccf979e
Update $.md
Managor Sep 27, 2024
8606c97
Update $.md
Managor Sep 27, 2024
31a6b11
Update >.md
Managor Sep 27, 2024
9e2b228
Rename <.md to less-than.md
Managor Sep 29, 2024
38dcb27
Rename >.md to greater-than.md
Managor Sep 29, 2024
3215ce2
Rename |.md to vertical-line.md
Managor Sep 29, 2024
cb0be64
Update vertical-line.md
Managor Sep 30, 2024
f8563fb
Rename vertical-line.md to vertical-bar.md
Managor Sep 30, 2024
df8160c
Rename greater-than.md to Greater-than.md
Managor Sep 30, 2024
ab0a32a
Rename less-than.md to Less-than.md
Managor Sep 30, 2024
5d7e179
Rename vertical-bar.md to Vertical-bar.md
Managor Sep 30, 2024
ac4a81a
Rename Greater-than.md to greater-than.md
Managor Sep 30, 2024
5b7e206
Rename Vertical-bar.md to vertical-bar.md
Managor Sep 30, 2024
f25c8d2
Rename Less-than.md to less-than.md
Managor Sep 30, 2024
c8fdfec
Update $.md
Managor Sep 30, 2024
d4b9121
Apply suggestions from code review
Managor Sep 30, 2024
8eb5500
Update pages/common/greater-than.md
spageektti Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pages/common/$.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Dollar sign
sebastiaanspeck marked this conversation as resolved.
Show resolved Hide resolved

> Expand a bash variable.
> More information: <https://gnu.org/software/bash/manual/bash.html#Shell-Variables>.

- Print a variable:

`echo ${{VARIABLE}}`

- Print the exit status of the previous command:

`echo $?`

- Print a random number between 0 and 32767:

`echo $RANDOM`

- Print one of the prompt strings:

`echo ${{PS1|PS2|PS3|PS4}}`

- Expand with the output of `command` and run it. Same as enclosing `command` in backtics:

`$({{command}})`
20 changes: 20 additions & 0 deletions pages/common/greater-than.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Greater than
sebastiaanspeck marked this conversation as resolved.
Show resolved Hide resolved

> Redirect output to a file.
> More information: <https://gnu.org/software/bash/manual/bash.html#Redirecting-Output>.

- Redirect `stdout` to a file:

`{{command}} > {{path/to/file}}`

- Append a file:
spageektti marked this conversation as resolved.
Show resolved Hide resolved

`{{command}} >> {{path/to/file}}`

- Redirect both `stdout` and `stderr` to a file:

`{{command}} &> {{path/to/file}}`

- Redirect both `stdout` and `stderr` to `/dev/null` to keep the terminal output clean:

`{{command}} &> /dev/null`
9 changes: 9 additions & 0 deletions pages/common/less-than.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Less than
sebastiaanspeck marked this conversation as resolved.
Show resolved Hide resolved

> Redirect a file to `stdin`.
> Achieves the same effect as `cat file.txt |`.
> More information: <https://gnu.org/software/bash/manual/bash.html#Redirecting-Input>.

- Redirect a file to `stdin`:

`{{command}} < {{path/to/file.txt}}`
12 changes: 12 additions & 0 deletions pages/common/vertical-bar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Vertical bar

> Pipe data between programs.
> More information: <https://gnu.org/software/bash/manual/bash.html#Pipelines>.

- Pipe `stdout` to `stdin`:

`{{command}} | {{command}}`

- Pipe both `stdout` and `stderr` to `stdin`:

`{{command}} |& {{command}}`
Loading