generate_range.sh - sfeed_tests - sfeed tests and RSS and Atom files
 (HTM) git clone git://git.codemadness.org/sfeed_tests
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       generate_range.sh (1577B)
       ---
            1 #!/bin/sh
            2 # test time range
            3 
            4 echo "<feed>"
            5 
            6 i="0"
            7 while :; do
            8         i=$((i+1))
            9         test "$i" -gt "9999" && break
           10 
           11         ts="$i-01-01 00:00:00"
           12         echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           13 
           14         ts="$i-03-01 00:00:00"
           15         echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           16 
           17         ts="$i-12-31 00:00:00"
           18         echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           19 
           20         # with prefix "0" for < 10.
           21         if test "$i" -lt 10; then
           22                 ts="$(printf '%02d-01-01 00:00:00' "$i")"
           23                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           24 
           25                 ts="$(printf '%02d-03-01 00:00:00' "$i")"
           26                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           27 
           28                 ts="$(printf '%02d-12-31 00:00:00' "$i")"
           29                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           30         fi
           31 
           32         # with prefix "0" for < 100.
           33         if test "$i" -lt 100; then
           34                 ts="$(printf '%03d-01-01 00:00:00' "$i")"
           35                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           36 
           37                 ts="$(printf '%03d-03-01 00:00:00' "$i")"
           38                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           39 
           40                 ts="$(printf '%03d-12-31 00:00:00' "$i")"
           41                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           42         fi
           43 
           44         # with prefix "0" or "00" for < 1000.
           45         if test "$i" -lt 1000; then
           46                 ts="$(printf '%04d-01-01 00:00:00' "$i")"
           47                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           48 
           49                 ts="$(printf '%04d-03-01 00:00:00' "$i")"
           50                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           51 
           52                 ts="$(printf '%04d-12-31 00:00:00' "$i")"
           53                 echo "<entry><updated>$ts</updated><title>$ts</title></entry>"
           54         fi
           55 done
           56 
           57 echo "</feed>"