bash_cheatsheet
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| bash_cheatsheet [2014/11/30 12:11] – [Work with file paths] ginko | bash_cheatsheet [2019/02/13 16:07] (current) – [Output of a shell command] ginko | ||
|---|---|---|---|
| Line 71: | Line 71: | ||
| ~% echo " | ~% echo " | ||
| gz</ | gz</ | ||
| + | ==== Output of a shell command ==== | ||
| + | * '' | ||
| + | mytimestamp=$(date ' | ||
| ===== Mastering history ===== | ===== Mastering history ===== | ||
| [[http:// | [[http:// | ||
| Line 87: | Line 90: | ||
| ===== Redirection ===== | ===== Redirection ===== | ||
| + | [[http:// | ||
| * Diriger plusieurs lignes vers un fichier :<code bash>/ | * Diriger plusieurs lignes vers un fichier :<code bash>/ | ||
| text1 | text1 | ||
| Line 93: | Line 97: | ||
| text4 | text4 | ||
| EOM</ | EOM</ | ||
| + | * Normal: | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * Append: | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * Pipes: | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | |||
| + | ==== The problem with cats ... ==== | ||
| + | |||
| + | Take a simple redirection example such as this: | ||
| + | |||
| + | '' | ||
| + | |||
| + | You've wasted a process on cat, since you could accomplish the same thing (and have it execute faster!) by doing this: | ||
| + | |||
| + | '' | ||
| + | |||
| + | ==== Sending stderr through a pipe ==== | ||
| + | |||
| + | Sending only stderr down a pipe, while having stdout still go to the screen, is an interesting trick. It can be done by passing the stdout and stderr file descriptors to temporary file descriptors, | ||
| + | |||
| + | '' | ||
| + | |||
| + | ===== Fonctions ===== | ||
| + | '' | ||
| + | |||
| + | On retrouve cette syntax au coeur de la fameuse fork bomb bash '': | ||
| + | |||
bash_cheatsheet.1417345893.txt.gz · Last modified: 2014/11/30 12:11 by ginko
