Avoiding error message '[: too many arguments'

Change-Id: I0253723078f5c3e77debfd8a8138559878544959
This commit is contained in:
Dmitry Teselkin 2013-08-29 15:26:45 +04:00
parent 87aa9c03fd
commit df201fd6b5
1 changed files with 2 additions and 2 deletions

View File

@ -42,12 +42,12 @@ function iniset {
local file=$4
local line
if [ -z $section ] ; then
if [ -z "$section" ] ; then
# No section name specified
sed -i -e "s/^\($option[ \t]*=[ \t]*\).*$/\1$value/" "$file"
else
# Check if section already exists
if [ ! grep -q "^\[$section\]" "$file" ]; then
if [ ! $(grep -q "^\[$section\]" "$file") ]; then
# Add section at the end
echo -e "\n[$section]" >>"$file"
fi