- if [ "$1" ]; then
- cat "$1"
- elif [ "$TYPE_FILES" = "a" ]; then
- cat sql.d/[0-9]*
- elif [ "$TYPE_FILES" = "d" ]; then
- cat sql.d/[0-9]*.{sql,devel}
- else
- cat sql.d/[0-9]*.sql
- fi
+ local old_ifs
+
+ old_ifs="$IFS"
+ IFS=" "
+ for fil in $(
+ if [ "$1" ]; then
+ echo "$1"
+ elif [ "$TYPE_FILES" = "a" ]; then
+ find sql.d/ -name '[0-9]*' -type f | sort -n | tr '\n' ' '
+ elif [ "$TYPE_FILES" = "d" ]; then
+ find sql.d/ -name '[0-9]*' | egrep '.*_devel.sql$|^[^_]+.sql$' | sort -n | tr '\n' ' '
+ else
+ find sql.d/ -name '[0-9]*' | egrep '^[^_]+.sql$' | sort -n | tr '\n' ' '
+ fi); do
+ echo "-- FILE BEG: $fil"
+ cat "$fil"
+ echo "-- FILE END: $fil"
+ done
+ IFS="$old_ifs"