From 2a71aed4cacf8949385f41b2b7ada4a0e9575b5a Mon Sep 17 00:00:00 2001 From: David Personette Date: Thu, 2 Jul 2020 22:08:03 -0400 Subject: [PATCH] samba.sh really fix #76 --- samba.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samba.sh b/samba.sh index e9c1027..14304f1 100755 --- a/samba.sh +++ b/samba.sh @@ -52,8 +52,8 @@ generic() { local section="$1" key="$(sed 's| *=.*||' <<< $2)" \ # Arguments: # option) raw option # Return: line added to smb.conf (replaces existing line with same key) -global() { local key="$(sed 's| *=.*||' <<< $1)" \ - value="$(sed 's|.*= *||' <<< $1)" file=/etc/samba/smb.conf +global() { local key="$(sed 's|\([^=]*\) += .*|\1|' <<< $1)" \ + value="$(sed 's|[^=]* += +||' <<< $1)" file=/etc/samba/smb.conf if sed -n '/^\[global\]/,/^\[/p' $file | grep -qE '^;*\s*'"$key"; then sed -i '/^\[global\]/,/^\[/s|^;*\s*\('"$key"' = \).*| \1'"$value"'|' \ "$file"