samba.sh really fix #76
This commit is contained in:
parent
83a0ccc9b9
commit
2a71aed4ca
4
samba.sh
4
samba.sh
@ -52,8 +52,8 @@ generic() { local section="$1" key="$(sed 's| *=.*||' <<< $2)" \
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# option) raw option
|
# option) raw option
|
||||||
# Return: line added to smb.conf (replaces existing line with same key)
|
# Return: line added to smb.conf (replaces existing line with same key)
|
||||||
global() { local key="$(sed 's| *=.*||' <<< $1)" \
|
global() { local key="$(sed 's|\([^=]*\) += .*|\1|' <<< $1)" \
|
||||||
value="$(sed 's|.*= *||' <<< $1)" file=/etc/samba/smb.conf
|
value="$(sed 's|[^=]* += +||' <<< $1)" file=/etc/samba/smb.conf
|
||||||
if sed -n '/^\[global\]/,/^\[/p' $file | grep -qE '^;*\s*'"$key"; then
|
if sed -n '/^\[global\]/,/^\[/p' $file | grep -qE '^;*\s*'"$key"; then
|
||||||
sed -i '/^\[global\]/,/^\[/s|^;*\s*\('"$key"' = \).*| \1'"$value"'|' \
|
sed -i '/^\[global\]/,/^\[/s|^;*\s*\('"$key"' = \).*| \1'"$value"'|' \
|
||||||
"$file"
|
"$file"
|
||||||
|
Loading…
Reference in New Issue
Block a user