diff --git a/import_to_hugo.sh b/import_to_hugo.sh index 52dcf66..ff32278 100755 --- a/import_to_hugo.sh +++ b/import_to_hugo.sh @@ -4,8 +4,8 @@ set -e # Check if the correct number of arguments is provided if [ "$#" -ne 2 ]; then - echo "Usage: move_logseq_content.sh " - exit 1 + echo "Usage: move_logseq_content.sh " + exit 1 fi # Extract arguments @@ -14,14 +14,14 @@ blog_folder="$2" # Check if the export folder exists if [ ! -d "$export_folder" ]; then - echo "Error: The export folder does not exist." - exit 1 + echo "Error: The export folder does not exist." + exit 1 fi # Check if the blog folder exists if [ ! -d "$blog_folder" ]; then - echo "Error: The blog folder does not exist." - exit 1 + echo "Error: The blog folder does not exist." + exit 1 fi blog_content_folder="${BLOG_CONTENT_FODLER:-/graph}" @@ -48,7 +48,8 @@ cp -R "$export_folder/logseq-pages"/* "$pages_destination/" cp -R "$export_folder/logseq-assets"/* "$assets_destination/" # replace the /logseq-asstes/ paths with the hugo image folder -find "$pages_destination" -type f -exec sed -i '' -e "s@/logseq-assets/@$images_folder/@g" {} \; -find "$pages_destination" -type f -exec sed -i '' -e "s@/logseq-pages/@$blog_content_folder/@g" {} \; +find "$pages_destination" -type f -exec sed -i.bak -e "s@/logseq-assets/@$images_folder/@g" {} \; +find "$pages_destination" -type f -exec sed -i.bak -e "s@/logseq-pages/@$blog_content_folder/@g" {} \; +rm -f "$pages_destination"/*.bak echo "Content moved successfully."