diff --git a/scripts/build-website.sh b/scripts/build-website.sh index 1768470..a2f47cc 100755 --- a/scripts/build-website.sh +++ b/scripts/build-website.sh @@ -3,29 +3,29 @@ # just gonna assume you're executing in the scripts folder # build the blog files -cd ../blog -CONTENTNUM=$(($(ls content-* | wc -l)-1)) -for ((i=-1;i<$CONTENTNUM;i++)) +cd ../blog || exit +CONTENTNUM=$(($( find . -type f -name "content-*" | wc -l)-1)) +for ((i=-1;i= 0 )) ;then + if (( i >= 0 )) ;then # prepare tail template cp filetail "$tailname" # increment int if the page exists - padintprev="$(printf %03d $(($i - 1)) )" - if (( $(($i+1)) == $CONTENTNUM )) ;then + padintprev="$(printf %03d $((i - 1)) )" + if (( $((i+1)) == CONTENTNUM )) ;then padintnext="$(printf %03d -1 )" else - padintnext="$(printf %03d $(($i + 1)) )" + padintnext="$(printf %03d $((i + 1)) )" fi # replace placeholders @@ -40,9 +40,9 @@ do done # clean up non prod files, lock down permissions, and self-destruct -cd ../blog +cd ../blog || exit \rm filehead filetail content* quote* .blog.* tail* -cd ../ +cd ../ || exit \rm -rf .git scripts .index.html.* README.md Jenkinsfile -find . -type f | xargs chmod 600 -find . -type d | xargs chmod 700 +find . -type f -exec chmod 600 {} \; +find . -type d -exec chmod 700 {} \;