mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
Make add-shell correctly handle /etc/shells files that do not end with newlines
Fixes https://github.com/fish-shell/fish-shell/issues/77
This commit is contained in:
parent
261bf12c91
commit
56599621cc
|
@ -31,11 +31,16 @@ EOF
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Append a newline if it doesn't exist
|
||||
if [ "$(tail -c1 "$tmpfile"; echo x)" != $'\nx' ]; then
|
||||
echo "" >> "$tmpfile"
|
||||
fi
|
||||
|
||||
for i
|
||||
do
|
||||
if ! grep -q "^${i}$" $tmpfile
|
||||
if ! grep -q "^${i}$" "$tmpfile"
|
||||
then
|
||||
echo $i >> $tmpfile
|
||||
echo $i >> "$tmpfile"
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user