From a9efd5bcb3d3b3e65d194efc4801a86e788aca02 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 2 Nov 2015 12:16:21 +0000 Subject: [PATCH] Line matching --- src/freedombone-addsipuser | 12 ++++++------ src/freedombone-rmsipuser | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/freedombone-addsipuser b/src/freedombone-addsipuser index f05338b7..d4b40482 100755 --- a/src/freedombone-addsipuser +++ b/src/freedombone-addsipuser @@ -45,7 +45,7 @@ function show_help { function sip_user_exists { IFS='' while read line; do - if [[ "$line" == "" ]]; then + if [[ "$line" == *"" ]]; then USER_EXISTS="yes" return fi @@ -62,17 +62,17 @@ function update_sip_user { IFS='' while read line; do if [ ! $USER_FOUND ]; then - if [[ "$line" == "" ]]; then + if [[ "$line" == *"" ]]; then USER_FOUND="yes" fi else - if [[ "$line" == ""* ]]; then + if [[ "$line" == *""* ]]; then line="$EXTENSION" fi - if [[ "$line" == ""* ]]; then + if [[ "$line" == *""* ]]; then line="$PASSWORD" fi - if [[ "$line" == ""* ]]; then + if [[ "$line" == *""* ]]; then line="$MY_USERNAME $EXTENSION" USER_FOUND= fi @@ -90,7 +90,7 @@ function add_sip_user { touch $NEW_CONFIG_FILE IFS='' while read line; do - if [[ "$line" == '' ]]; then + if [[ "$line" == *'' ]]; then echo "" >> $NEW_CONFIG_FILE echo "$EXTENSION" >> $NEW_CONFIG_FILE echo "$PASSWORD" >> $NEW_CONFIG_FILE diff --git a/src/freedombone-rmsipuser b/src/freedombone-rmsipuser index b2951cb8..0c514f46 100755 --- a/src/freedombone-rmsipuser +++ b/src/freedombone-rmsipuser @@ -43,7 +43,7 @@ function show_help { function sip_user_exists { IFS='' while read line; do - if [[ "$line" == "" ]]; then + if [[ "$line" == *"" ]]; then USER_EXISTS="yes" return fi @@ -60,14 +60,14 @@ function remove_sip_user { IFS='' while read line; do if [ ! $USER_FOUND ]; then - if [[ "$line" == "" ]]; then + if [[ "$line" == *"" ]]; then USER_FOUND="yes" fi fi if [ ! $USER_FOUND ]; then echo "$line" >> $NEW_CONFIG_FILE else - if [[ "$line" == '' ]]; then + if [[ "$line" == *'' ]]; then USER_FOUND= fi fi