Browse Source

Fixed bug in BSD date

Carlos Fenollosa 11 years ago
parent
commit
57f5ef7694
1 changed files with 4 additions and 3 deletions
  1. 4 3
      bb.sh

+ 4 - 3
bb.sh

@@ -719,11 +719,11 @@ rebuild_all_entries() {
         awk '/<!-- text begin -->/, /<!-- text end -->/{if (!/<!-- text begin -->/ && !/<!-- text end -->/) print}' "$i" >> "$contentfile"
         awk '/<!-- text begin -->/, /<!-- text end -->/{if (!/<!-- text begin -->/ && !/<!-- text end -->/) print}' "$i" >> "$contentfile"
 
 
         # Original post timestamp
         # Original post timestamp
-        timestamp="$(date -r $i +"%a, %d %b %Y %H:%M:%S %z" )"
+        timestamp="$(LC_ALL=$date_locale date -r $i +"%a, %d %b %Y %H:%M:%S %z" )"
 
 
         create_html_page "$contentfile" "$i.rebuilt" no "$title" "$timestamp"
         create_html_page "$contentfile" "$i.rebuilt" no "$title" "$timestamp"
         # keep the original timestamp!
         # keep the original timestamp!
-        timestamp="$(date -r $i +'%Y%m%d%H%M')"
+        timestamp="$(LC_ALL=$date_locale date -r $i +'%Y%m%d%H%M')"
         mv "$i.rebuilt" "$i"
         mv "$i.rebuilt" "$i"
         chmod 644 "$i"
         chmod 644 "$i"
         touch -t $timestamp "$i"
         touch -t $timestamp "$i"
@@ -782,7 +782,8 @@ date_version_detect() {
                     stat -f "%Sm" -t "$format" "$2"
                     stat -f "%Sm" -t "$format" "$2"
                 elif [[ $(echo $@ | grep '\-\-date') ]]; then
                 elif [[ $(echo $@ | grep '\-\-date') ]]; then
                     # convert between dates using BSD date syntax
                     # convert between dates using BSD date syntax
-                    /bin/date -j -f "%a, %d %b %Y %H:%M:%S %z" "$(echo $3 | sed 's/\-\-date\=//g')" "$2" 
+                    echo 3="$3" 2="$2"
+                    /bin/date -j -f "%a, %d %b %Y %H:%M:%S %z" "$(echo $2 | sed 's/\-\-date\=//g')" "$1" 
                 else
                 else
                     # acceptable format for BSD date
                     # acceptable format for BSD date
                     /bin/date -j "$@"
                     /bin/date -j "$@"