samples: . accepts previous comment as-is
When updating a sample configuration with a comment, a dot '.'
in the new comment keeps the previous comment.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
1.1 --- a/scripts/saveSample.sh.in Tue Jan 03 22:57:25 2012 +0100
1.2 +++ b/scripts/saveSample.sh.in Mon Apr 09 11:19:51 2012 +0200
1.3 @@ -121,14 +121,18 @@
1.4 [ -f "${samp_dir}/reported.by" ] && . "${samp_dir}/reported.by"
1.5 old_name="${reporter_name}"
1.6 old_url="${reporter_url}"
1.7 +old_comment="${reporter_comment}"
1.8 read -p "Reporter name [${reporter_name}]: " reporter_name
1.9 read -p "Reporter URL [${reporter_url}]: " reporter_url
1.10 if [ -n "${reporter_comment}" ]; then
1.11 - echo "Old comment if you need to copy-paste:"
1.12 - printf "${reporter_comment}\n"
1.13 + echo "Old comment:"
1.14 + printf "${reporter_comment}\n" |sed -r -e 's/^/ > /;'
1.15 fi
1.16 -echo "Reporter comment (Ctrl-D to finish):"
1.17 +echo "Reporter comment (Ctrl-D to finish, '.' to use previous):"
1.18 reporter_comment=$(cat)
1.19 +if [ "${reporter_comment}" = "." ]; then
1.20 + reporter_comment="${old_comment}"
1.21 +fi
1.22
1.23 ( echo "reporter_name=\"${reporter_name:=${old_name}}\""
1.24 echo "reporter_url=\"${reporter_url:=${old_url}}\""