From 6fb48d0eea204b400f81a894dfd9880f69e639a6 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 6 Jan 2013 21:58:04 -0800 Subject: Simplify line_count and pick_fields --- git-remote-gcrypt | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/git-remote-gcrypt b/git-remote-gcrypt index 81477e4..cb3dfea 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -85,16 +85,14 @@ append_to() # $2 input value pick_fields_1_2() { - local f_ret= f_line= f_var= f_oifs="$IFS" IFS= - f_var=$1 - IFS=$Newline - for f_line in $2 + local f_ret= f_one= f_two= + while read f_one f_two _ # from << here-document do - IFS=$f_oifs - set -- $f_line - f_ret=$f_ret"${1:-} ${2:-}"$Newline - done - setvar "$f_var" "${f_ret#$Newline}" + f_ret="$f_ret$f_one $f_two$Newline" + done <