dotfiles/bin/br

26 lines
450 B
Plaintext
Raw Normal View History

2020-11-05 17:24:31 +00:00
#!/bin/sh
2020-11-08 16:26:14 +00:00
# rule 1: use single quote '
# rule 2: //// for literal /
set -e
FILES=$(awk '{print}')
COL=$(tput cols)
PAT=$1
STR=$2
export COL PAT STR
2020-11-05 17:24:31 +00:00
2020-11-08 16:26:14 +00:00
echo "$FILES" | while IFS= read -r FILE; do
bin/fr "$FILE"
done | less
2020-11-05 17:24:31 +00:00
2020-11-08 16:26:14 +00:00
printf "Are you sure [y/N]? "
read -r YN < /dev/tty
if [ "$YN" = 'y' ]; then
echo "$FILES" | while IFS= read -r FILE; do
TMP=$(mktemp)
REP=1 bin/fr "$FILE" > "$TMP"
mv "$TMP" "$FILE"
done
fi