aboutsummaryrefslogtreecommitdiff
path: root/bash
Commit message (Collapse)AuthorAgeFilesLines
* Remove custom length limit on login fortunesTom Ryder2016-07-231-1/+1
| | | | OpenBSD doesn't have -n
* Replace use of ${var:?} with explicit errorsTom Ryder2016-07-151-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <http://mywiki.wooledge.org/BashFAQ/100#Default_or_alternate_values> >Nobody ever uses ${var?word} or ${var:?word}. Please pretend they don't >exist, just like you pretend set -e and set -u don't exist. ><tejr> from FAQ 100: >Nobody ever uses ${var?word} or ${var:?word}. ><tejr> why is that? just because it's unwieldy, or are there other >technical reasons? ><ormaaj> tejr: Putting random fatal unhandlable errors into a script is >generally useless. ><tejr> ormaaj: is it less handleable than a more explicit check, like >`[[ $var ]] || exit 1` ? ><ormaaj> yes ><ormaaj> # : ; ${_[RANDOM%2]?:you win} ><shbot> ormaaj: no output ><ormaaj> didn't win ><tejr> i was thinking more as a terse means of perhaps asserting a >variable had a value, like a positional parameter; are you saying if >you really did just want to write to stderr and exit with failure, it's >still inappropriate? ><ormaaj> depends on the complexity I suppose but I'd not consider that >unless it's the global scope in a file you know isn't going to be >sourced and has no other explicit error handling. Even then it's ugly >because it bails out in the middle of evaluating parameters that >technically could have side-effects and such. ><tejr> ahh yes, kinda a separation of concerns ><tejr> that makes more sense now! thank you > * tejr combs his scripts to see if he's used it anywhere ><ormaaj> tejr: another reason is the type of error is a bash error >which usually indicates a problem with the script where bash itself >can't continue. An unset var isn't a " bash error", You can even make >it print counterintuitive error messages that look like bash internal >errors. ><tejr> ormaaj: also compelling ><tejr> i've found a few "{@:?}"s in here so i'm fixing them up now ><tejr> thanks for the analysis
* Quote expansions within parameter expansionsTom Ryder2016-07-1513-22/+21
| | | | | | I made the incorrect assumption that it was safe not to do this; expansions that include glob characters, for example, can cause problems.
* Terser `read -rd ''` idiomTom Ryder2016-07-1511-12/+12
|
* Use set rather than building arg arraysTom Ryder2016-07-025-32/+27
| | | | | | Allows for terser functions and avoids error-prone local variables; also nicer to have a single `command` call at the end of the function (although there are still two at the end of the ed(1) wrapper)
* Terser pa/paz implementationsTom Ryder2016-07-022-6/+4
|
* Switch back to read array split for targetsTom Ryder2016-06-251-2/+8
| | | | Works better than the well-intended while-read loop
* More efficient/terser make(1) completionTom Ryder2016-06-241-21/+29
|
* Remove unneeded linebreak backslashesTom Ryder2016-06-216-17/+14
| | | | | | | | | | | Handy command: $ find bin sh bash -type f -exec grep \ -e '|| \\$' \ -e '&& \\$' \ -e '^\s*||' \ -e '^\s*&&' \ {} +
* Correct td(1) completionTom Ryder2016-06-151-4/+4
| | | | Forgot to narrow completions down to ones that match the current word
* Add per-file editing and completion for td(1)Tom Ryder2016-06-141-0/+18
| | | | I have "todo", "comp", and "writ".
* Switch from prompt image to plain textTom Ryder2016-06-091-1/+1
| | | | More compatible, want to display this in Cgit as well
* Move PROMPT_RETURN declaration to top of funcTom Ryder2016-05-041-1/+4
|
* Add means to change prompt colorTom Ryder2016-04-231-3/+8
|
* Remove curly bracesTom Ryder2016-04-141-1/+1
|
* Remove blank lines at end of filesTom Ryder2016-03-2858-58/+0
|
* Add readv functionTom Ryder2016-03-281-0/+26
|
* Complete man pages only for exact section matchTom Ryder2016-03-191-1/+1
|
* Refactor ed() wrapper, add rlwrap(1)Tom Ryder2016-03-161-7/+22
|
* Remove unneeded read junk varTom Ryder2016-03-151-1/+1
|
* Protect PS1 variable expansionsTom Ryder2016-03-151-2/+2
|
* Only show git VCS stuff by defaultTom Ryder2016-03-141-1/+6
| | | | | | | | On my work machines, I'll make a file ~/.bashrc.d/prompt.bash which includes a PROMPT_VCS=(git svn) line. I don't really use Mercurial at all, now that the Vim sources have moved to Git; certainly not enough to check for it on every prompt load ...
* md() shortcut for mkdir(1)Tom Ryder2016-03-051-0/+5
|
* Tell shellcheck it's wrong about this lineTom Ryder2016-03-031-3/+2
|
* Add clwr() funcTom Ryder2016-03-021-0/+9
|
* Unsigned integers for printfTom Ryder2016-02-273-3/+3
|
* Variable assignments are not Makefile targetsTom Ryder2016-01-071-1/+1
|
* Add man page section to commentTom Ryder2015-12-241-2/+2
|
* Add missing case terminatorTom Ryder2015-12-241-0/+2
|
* Remove unneeded extglob setTom Ryder2015-12-241-3/+2
|
* Improve pattern matching a bitTom Ryder2015-12-241-1/+1
|
* Better section management for man completionTom Ryder2015-12-221-8/+15
|
* Avoid calling cat(1) by using builtinsTom Ryder2015-12-182-2/+6
|
* Flatten _path completion spec a bitTom Ryder2015-12-151-54/+51
|
* Make short-circuits a bit more explicitTom Ryder2015-12-153-8/+22
|
* Flatten bash_profile.d subscripts a bitTom Ryder2015-12-153-16/+34
|
* Remove unneeded args specTom Ryder2015-12-151-1/+1
|
* Localise a stray variableTom Ryder2015-12-141-0/+1
|
* Switch to a faster method of array appendingTom Ryder2015-12-1419-58/+59
| | | | | Does away with the nasty hack around man page discovery, and still compatible with Bash 2.05a
* Fix some EnglishTom Ryder2015-12-131-1/+1
|
* Add more detail on bashkeep usageTom Ryder2015-12-111-6/+25
|
* Whoops, dropped an important characterTom Ryder2015-12-111-1/+1
|
* Put printing/globbing in subshellTom Ryder2015-12-111-5/+9
|
* Create bashkeep directory if it doesn't existTom Ryder2015-12-111-0/+1
|
* Restore previous fnl syntax for shellcheckTom Ryder2015-12-111-2/+3
|
* Add keepTom Ryder2015-12-111-0/+134
|
* Fix some trailing spacesTom Ryder2015-12-011-1/+1
|
* Fix up some mktemp(1) templatesTom Ryder2015-11-271-3/+2
|
* Remove a now-inapplicable commentTom Ryder2015-11-271-4/+0
|
* Strip colons from COMP_WORDBREAKSTom Ryder2015-11-271-5/+6
| | | | <http://tiswww.case.edu/php/chet/bash/FAQ> E13