#!/bin/sh # 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 echo "$FILES" | while IFS= read -r FILE; do bin/fr "$FILE" done | less 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