The URL style of this wiki was changed. All old URLs should continue to work, but please update your links. New base is http://wiki.bash-hackers.org
What would YOU like to see here? (outdated and locked, please use the discussions)
Stranger! Feel free to register and edit the contents. There is a Bash Hackers Wiki needs love page that lists some things to do. The registration is only there to prevent SPAM.
Bash version 4 is here! New information is being merged into this documentation step by step. The logo
indicates Bash version 4 features or behaviour. There is also a small text about the interesting changes: Bash 4 - a rough overview
Scripting with style – an assorted collection of style and optic hintsThere is a section that holds small code snipplets.
See also some Bash source code excerpts.
Doing specific tasks: concepts, ways, ideas:
| Introduction to expansions and substitutions | |
|---|---|
{A,B,C} {A..C} | Brace expansion |
~/ ~root/ | Tilde expansion |
$FOO ${BAR%.mp3} | Parameter expansion |
`command` $(command) | Command substitution |
<(command) >(command) | Process substitution |
$((1 + 2 + 3)) $[4 + 5 + 6] | Arithmetic expansion |
... | Word splitting |
/data/*-av/*.mp? | Pathname expansion |
| Compound commands overview | |
|---|---|
| Grouping | |
{ ...; } | command grouping |
( ... ) | command grouping in a subshell |
| Conditionals | |
[[ ... ]] | conditional expression |
if ...; then ...; fi | conditional branching |
case ... esac | pattern-based branching |
| Loops | |
for word in ...; do ...; done | classic for-loop |
for ((x=1; x<=10; x++)); do ...; done | C-style for-loop |
while ...; do ...; done | while loop |
until ...; do ...; done | until loop |
| Misc | |
(( ... )) | arithmetic evaluation |
select word in ...; do ...; done | user selections |
This is a selection of builtin commands and command-like keywords.
| A-G | |
|---|---|
| coproc | Co-processes |
| I-N | |
| let | arithmetic evaluation - an old fashioned way (Bash builtin) |
| mapfile | Mapping lines of input to an array, also named readarray (Bash builtin) |
| O-T | |
| printf | "advanced echo" (Bash builtin) |
| read | getting input from stdin (Bash builtin) |
| set | control positional parameters and shell behaviour (Bash builtin) |
| shopt | set/get shell options (Bash builtin) |
| test | the classic test command (Bash builtin) |
| U-Z | |
| Statistics for Month: July 2010 | ||
|---|---|---|
| Rank | Views | Article |
| 1 | 1905 | Small getopts tutorial (June: 3454) |
| 2 | 1609 | The printf command (June: 875) |
| 3 | 819 | Quotes and escaping (June: 796) |
| 4 | 785 | Arithmetic expressions (June: 565) |
| 5 | 774 | Parameter expansion (June: 579) |
| 6 | 744 | Bash 4 - a rough overview (June: 660) |
| 7 | 724 | Lock your script (against parallel run) (June: 534) |
| 8 | 704 | Editing files with the ed text editor from scripts (June: –) |
| 9 | 653 | The classic test command (June: 530) |
| 10 | 569 | Config files for your script (June: 606) |
July total views (all wiki pages): 41156 views (June: 42982)
lhunath is making a Bash Guide on Greg's wiki (designed for newbies)irc.freenode.net, channel #bash
If you have critics or suggestions, please feel free to send a mail using the contact form on the right. If you have quick suggestions, you can also use the Wishlist (editable by everyone!). Note that there is a discussion platform below every article page.
Please also see the imprint if you have problems with the site and its contents (legality, ...)!
It also would be nice to drop a line when
Simply: Reader's feedback