Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tools:shell [2023/09/18 13:56] – removed - external edit (Unknown date) 127.0.0.1 | tools:shell [2026/07/01 12:16] (current) – [Tutorials] will | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Shell ====== | ||
| + | eg. '' | ||
| + | ===== Tutorials ===== | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * Pitt's [[https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | ==== Readline Keyboard Shortcut reference ==== | ||
| + | | ||
| + | |||
| + | ===== Utilities ===== | ||
| + | fzf, fasd (z), readline editing options, alt+., ctrl+r, [[https:// | ||
| + | |||
| + | ===== Idioms | ||
| + | |||
| + | short if-statements. short form function definitions. regexp w/ | ||
| + | < | ||
| + | if [ -r file.txt ]; then | ||
| + | rm file.txt | ||
| + | fi | ||
| + | |||
| + | # same as | ||
| + | [ -r file.txt ] && rm file.txt | ||
| + | |||
| + | # same as | ||
| + | test -r file.txt && rm " | ||
| + | |||
| + | #### | ||
| + | |||
| + | function abc { | ||
| + | echo abc | ||
| + | } | ||
| + | |||
| + | # same as | ||
| + | abc(){ echo abc; } | ||
| + | |||
| + | ### | ||
| + | |||
| + | foobar=" | ||
| + | [[ $foobar =~ c.* ]] && echo $BASH_REMATCH # c3 | ||
| + | </ | ||
| + | |||
| + | ===== Input Arguments ===== | ||
| + | Both functions and scripts take "input arguments": | ||
| + | |||
| + | |||
| + | ''" | ||
| + | '' | ||
| + | < | ||
| + | nargs() | ||
| + | arg_at() | ||
| + | arg_star() { nargs " | ||
| + | |||
| + | arg_at | ||
| + | arg_star a b c # 1 | ||
| + | |||
| + | second() | ||
| + | arg_at2() | ||
| + | arg_star2(){ second " | ||
| + | |||
| + | arg_at2 | ||
| + | arg_star2 a b c # ** | ||
| + | |||
| + | </ | ||