On Thu, Dec 20, 2012 at 01:06:36AM +0100, Florian Pritz wrote:
> Signed-off-by: Florian Pritz <[email protected]>
> ---
> Now uses printf instead of echo -n.
> 
>  contrib/pacdiff.sh.in | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
> index 86dc20e..3461627 100644
> --- a/contrib/pacdiff.sh.in
> +++ b/contrib/pacdiff.sh.in
> @@ -97,15 +97,16 @@ while IFS= read -u 3 -r -d '' pacfile; do
>               echo "  Files are identical, removing..."
>               rm -v "$pacfile"
>       else
> -             echo -n "  File differences found. (V)iew, (S)kip, (R)emove: 
> [v/s/r] "
> +             printf "  (V)iew, (S)kip, (R)emove $file_type, (O)verwrite with 
> $file_type: [v/s/r/o] "

You're using the prompt as a format string. It's obvious what the
possible values for $file_type are, but I'd rather these be inserted as
tokens replacements rather than embedded in the format string.

>               while read c; do
>                       case $c in
>                               r|R) rm -v "$pacfile"; break ;;
> +                             o|O) mv -v "$pacfile" "$file"; break ;;
>                               v|V)
>                               $diffprog "$pacfile" "$file"
>                               rm -iv "$pacfile"; break ;;
>                               s|S) break ;;
> -                             *) echo -n "  Invalid answer. Try again: 
> [v/s/r] "; continue ;;
> +                             *) printf "  Invalid answer. Try again: 
> [v/s/r/o] "; continue ;;

Here too.

>                       esac
>               done
>       fi
> -- 
> 1.8.0.2
> 

Reply via email to