From 56599621ccfd06587eefff67b6713d428bcddbd0 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 22 Jul 2012 16:59:08 -0700 Subject: [PATCH] Make add-shell correctly handle /etc/shells files that do not end with newlines Fixes https://github.com/fish-shell/fish-shell/issues/77 --- build_tools/osx_package_scripts/add-shell | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build_tools/osx_package_scripts/add-shell b/build_tools/osx_package_scripts/add-shell index 3544ebfc6..d12fc0620 100755 --- a/build_tools/osx_package_scripts/add-shell +++ b/build_tools/osx_package_scripts/add-shell @@ -21,7 +21,7 @@ tmpfile=${file}.tmp set -o noclobber trap "rm -f $tmpfile" EXIT - + if ! cat $file > $tmpfile then cat 1>&2 <> "$tmpfile" +fi + for i do - if ! grep -q "^${i}$" $tmpfile + if ! grep -q "^${i}$" "$tmpfile" then - echo $i >> $tmpfile + echo $i >> "$tmpfile" fi done