| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Filter out uninformative output lines from the ldap-sync cron job script | 3 # Filter out uninformative output lines from the ldap-sync cron job script |
| 4 | 4 |
| 5 last_action="" | 5 last_action="" |
| 6 | 6 |
| 7 while read line; do | 7 while read line; do |
| 8 case "$line" in | 8 case "$line" in |
| 9 *-\>*) | 9 *-\>*) |
| 10 case "$last_action" in | 10 if [ ! -z "$last_action" ] |
|
mathias
2018/06/19 13:12:39
As discussed, please replace the inner `case` stat
| |
| 11 *-\>*) | 11 then |
| 12 echo "$line" | 12 echo "$last_action" |
| 13 ;; | 13 fi |
| 14 *) | 14 |
| 15 echo "$last_action" | 15 echo "$line" |
| 16 echo "$line" | 16 last_action="" |
| 17 last_action="$line" | |
| 18 ;; | |
| 19 esac | |
| 20 ;; | 17 ;; |
| 21 *Found*users* | \ | 18 --\ Found\ *\ users* | \ |
|
mathias
2018/06/19 13:12:40
How about `"* Found * users *"`?
| |
| 22 *\#* | \ | 19 \#* | \ |
| 23 *Synchronizing*groups* | \ | 20 *Synchronizing\ *\ groups* | \ |
| 24 *Synchronizing*users* | \ | 21 \*\*\ Synchronizing\ *\ users* | \ |
| 25 *Updating?user?\'*\'?\(*\)* | \ | 22 --\ Updating\ user\ \'*\'?\(*\)* | \ |
| 26 *Updating?group?\'*\'* | \ | 23 --\ Updating\ group\ \'*\'* | \ |
| 27 *Creating?user?\'*\'?\(*\)* | \ | 24 --\ Creating\ user\ \'*\'?\(*\)* | \ |
| 28 *Creating?group?\'*\'*) | 25 --\ Creating\ group\ \'*\'*) |
| 29 last_action="$line" | 26 last_action="$line" |
| 30 continue | |
|
mathias
2018/06/19 13:12:39
Not: The `continue` statement is not exactly neces
| |
| 31 ;; | 27 ;; |
| 32 *) | 28 *) |
| 33 echo "$line" | 29 echo "$line" |
| 34 ;; | 30 ;; |
| 35 esac | 31 esac |
| 36 done | 32 done |
| LEFT | RIGHT |