**Bring executables into better shellcheck compliance** While evaluating linting and testing options for our shell configuration, a run of Shellcheck against our executables turned up some places where we could use more consistent syntax across our executables, such as always using a shebang or quoting `$HOME` when we build up a larger directory. **Update syntax for zsh functions and completions** A few changes found while linting zsh configs with shellcheck: * thoughtbot's [style guide] [guide] calls for `$(..)` over backticks when capturing command output * use `-gt` to test array length in arguments [guide]: https://github.com/thoughtbot/guides/tree/master/best-practices
12 lines
215 B
Bash
Executable file
12 lines
215 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Find and replace by a given list of files.
|
|
#
|
|
# replace foo bar **/*.rb
|
|
|
|
find_this="$1"
|
|
shift
|
|
replace_with="$1"
|
|
shift
|
|
|
|
ag -l --nocolor "$find_this" "$@" | xargs sed -i '' "s/$find_this/$replace_with/g"
|