소스 검색

Line matching

Bob Mottram 9 년 전
부모
커밋
a9efd5bcb3
2개의 변경된 파일9개의 추가작업 그리고 9개의 파일을 삭제
  1. 6
    6
      src/freedombone-addsipuser
  2. 3
    3
      src/freedombone-rmsipuser

+ 6
- 6
src/freedombone-addsipuser 파일 보기

@@ -45,7 +45,7 @@ function show_help {
45 45
 function sip_user_exists {
46 46
     IFS=''
47 47
     while read line; do
48
-        if [[ "$line" == "<user id=\"$MY_USERNAME\">" ]]; then
48
+        if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
49 49
             USER_EXISTS="yes"
50 50
             return
51 51
         fi
@@ -62,17 +62,17 @@ function update_sip_user {
62 62
     IFS=''
63 63
     while read line; do
64 64
         if [ ! $USER_FOUND ]; then
65
-            if [[ "$line" == "<user id=\"$MY_USERNAME\">" ]]; then
65
+            if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
66 66
                 USER_FOUND="yes"
67 67
             fi
68 68
         else
69
-            if [[ "$line" == "<extension>"* ]]; then
69
+            if [[ "$line" == *"<extension>"* ]]; then
70 70
                 line="<extension>$EXTENSION</extension>"
71 71
             fi
72
-            if [[ "$line" == "<secret>"* ]]; then
72
+            if [[ "$line" == *"<secret>"* ]]; then
73 73
                 line="<secret>$PASSWORD</secret>"
74 74
             fi              
75
-            if [[ "$line" == "<display>"* ]]; then
75
+            if [[ "$line" == *"<display>"* ]]; then
76 76
                 line="<display>$MY_USERNAME $EXTENSION</display>"
77 77
                 USER_FOUND=
78 78
             fi              
@@ -90,7 +90,7 @@ function add_sip_user {
90 90
     touch $NEW_CONFIG_FILE
91 91
     IFS=''
92 92
     while read line; do
93
-        if [[ "$line" == '</provision>' ]]; then
93
+        if [[ "$line" == *'</provision>' ]]; then
94 94
             echo "<user id=\"$MY_USERNAME\">" >> $NEW_CONFIG_FILE
95 95
             echo "<extension>$EXTENSION</extension>" >> $NEW_CONFIG_FILE
96 96
             echo "<secret>$PASSWORD</secret>" >> $NEW_CONFIG_FILE

+ 3
- 3
src/freedombone-rmsipuser 파일 보기

@@ -43,7 +43,7 @@ function show_help {
43 43
 function sip_user_exists {
44 44
     IFS=''
45 45
     while read line; do
46
-        if [[ "$line" == "<user id=\"$MY_USERNAME\">" ]]; then
46
+        if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
47 47
             USER_EXISTS="yes"
48 48
             return
49 49
         fi
@@ -60,14 +60,14 @@ function remove_sip_user {
60 60
     IFS=''
61 61
     while read line; do
62 62
         if [ ! $USER_FOUND ]; then
63
-            if [[ "$line" == "<user id=\"$MY_USERNAME\">" ]]; then
63
+            if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
64 64
                 USER_FOUND="yes"
65 65
             fi
66 66
         fi
67 67
         if [ ! $USER_FOUND ]; then
68 68
             echo "$line" >> $NEW_CONFIG_FILE
69 69
         else
70
-            if [[ "$line" == '</user>' ]]; then
70
+            if [[ "$line" == *'</user>' ]]; then
71 71
                 USER_FOUND=
72 72
             fi
73 73
         fi