Index: edit.sh |
diff --git a/edit.sh b/edit.sh |
new file mode 100755 |
index 0000000000000000000000000000000000000000..aa0f640330dc4b7af8adeb1e5c562054c6e8cb60 |
--- /dev/null |
+++ b/edit.sh |
@@ -0,0 +1,33 @@ |
+#!/bin/sh |
+##################################################################### |
+##################################################################### |
+## The cause of this script is to make the output of the LDAP ## |
+## sync cron job more readable by filtering all repeated lines ## |
+##################################################################### |
+##################################################################### |
f.lopez
2018/05/15 00:51:19
"Filters out repeated lines from LDAP sync cron jo
|
+ |
+last_updated="" |
+ |
+while IFS= read -r line; do |
f.lopez
2018/05/15 00:51:19
This IFS set is redundant here because you are quo
|
+ if echo "$line" | grep -q "Updating" || |
f.lopez
2018/05/15 00:51:19
can't you avoid repeating yourself here with the `
|
+ echo "$line" | grep -q "Creating" |
+ then |
+ last_updated="$line" |
+ fi |
+ |
+ if echo "$line" | grep -q -v "Updating" && |
f.lopez
2018/05/15 00:51:19
You can use the `-F` flag for all lines so you don
|
+ echo "$line" | grep -q -v "Creating" && |
+ echo "$line" | grep -q -v "Found" && |
+ echo "$line" | grep -q -v "#" && |
+ echo "$line" | grep -q -v "Synchronizing" && |
+ echo "$line" | grep -q -v -F -e "->" |
+ then |
+ echo $line |
f.lopez
2018/05/15 00:51:19
my editor shows an empty space at the end of this
|
+ fi |
+ |
+ if echo "$line" | grep -q -F -e "->" |
f.lopez
2018/05/15 00:51:19
no need for `-F` flag since you are matching a sin
|
+ then |
+ echo $last_updated |
+ echo $line |
f.lopez
2018/05/15 00:51:19
Quote both lines here
http://www.tldp.org/LDP/abs
|
+ fi |
+done |
f.lopez
2018/05/15 00:51:19
add an empty line at the end of the file
|