diff options
| author | Yigit Sever | 2021-11-07 23:42:15 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-11-07 23:42:15 +0300 |
| commit | 9fa9973c2d2f91cef7bdd26cb52064c13f4d682e (patch) | |
| tree | 13aa64b09bc91e16f3dd3217bf3d647559af2cf9 /.local/bin/weasel | |
| parent | 9382166b5522a5d9e2d62e93e702b4d0886cedb4 (diff) | |
| parent | fcb2237c01bcd2b7982bb844cea4cf9447f20d03 (diff) | |
| download | dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.tar.gz dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.tar.bz2 dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.zip | |
Merge remote-tracking branch 'origin/main'
Diffstat (limited to '.local/bin/weasel')
| -rwxr-xr-x | .local/bin/weasel | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/.local/bin/weasel b/.local/bin/weasel new file mode 100755 index 0000000..ce82ce3 --- /dev/null +++ b/.local/bin/weasel | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | |||
| 3 | weasels="many|various|very|fairly|several|extremely\ | ||
| 4 | |exceedingly|quite|remarkably|few|surprisingly\ | ||
| 5 | |mostly|largely|huge|tiny|((are|is) a number)\ | ||
| 6 | |excellent|interestingly|significantly\ | ||
| 7 | |substantially|clearly|vast|relatively|completely" | ||
| 8 | |||
| 9 | wordfile="" | ||
| 10 | |||
| 11 | # Check for an alternate weasel file | ||
| 12 | if [ -f "$HOME"/etc/words/weasels ]; then | ||
| 13 | wordfile="$HOME/etc/words/weasels" | ||
| 14 | fi | ||
| 15 | |||
| 16 | if [ -f "$WORDSDIR"/weasels ]; then | ||
| 17 | wordfile="$WORDSDIR/weasels" | ||
| 18 | fi | ||
| 19 | |||
| 20 | if [ -f words/weasels ]; then | ||
| 21 | wordfile="words/weasels" | ||
| 22 | fi | ||
| 23 | |||
| 24 | if [ ! "$wordfile" = "" ]; then | ||
| 25 | weasels="xyzabc123" | ||
| 26 | for w in $(cat $wordfile); do | ||
| 27 | weasels="$weasels|$w" | ||
| 28 | done | ||
| 29 | fi | ||
| 30 | |||
| 31 | if [ "$1" = "" ]; then | ||
| 32 | echo "usage: $(basename "$0") <file> ..." | ||
| 33 | exit | ||
| 34 | fi | ||
| 35 | |||
| 36 | grep -E -i -n --color "\\b($weasels)\\b" "$*" | ||
| 37 | |||
| 38 | exit $? | ||
