+check_mode_order() {
+FOUND_WRITE="NO"
+CAUSE="You are reading data before writing them "
+
+# If no write occurs, let's show a different message
+echo $MODES | grep -q "write"
+if [ "$?" -ne 0 ]; then
+ CAUSE="You are reading data while never wrote them before"
+fi
+
+for mode in $(echo $MODES | tr "," " "); do
+ echo $mode | grep -q write
+ if [ "$?" -eq 0 ]; then
+ FOUND_WRITE="YES"
+ fi
+ echo $mode | grep -q "read"
+ if [ "$?" -eq 0 ]; then
+ if [ "$FOUND_WRITE" = "NO" ]; then
+ echo "###############################################################"
+ echo "# Warning : $CAUSE#"
+ echo "# On some storage devices, this could lead to invalid results #"
+ echo "# #"
+ echo "# Press Ctrl-C to adjust pattern order if you have doubts #"
+ echo "# Or Wait 5 seconds before the file will be created #"
+ echo "###############################################################"
+ sleep 5
+ # No need to try showing the message more than one time
+ return
+ fi
+ fi
+done
+}
+