Skip to content

Commit 03e5782

Browse files
committed
fix: make the import_to_hugo.sh script work on linux
1 parent e286fa3 commit 03e5782

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

import_to_hugo.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -e
44

55
# Check if the correct number of arguments is provided
66
if [ "$#" -ne 2 ]; then
7-
echo "Usage: move_logseq_content.sh <export_folder> <blog_folder>"
8-
exit 1
7+
echo "Usage: move_logseq_content.sh <export_folder> <blog_folder>"
8+
exit 1
99
fi
1010

1111
# Extract arguments
@@ -14,14 +14,14 @@ blog_folder="$2"
1414

1515
# Check if the export folder exists
1616
if [ ! -d "$export_folder" ]; then
17-
echo "Error: The export folder does not exist."
18-
exit 1
17+
echo "Error: The export folder does not exist."
18+
exit 1
1919
fi
2020

2121
# Check if the blog folder exists
2222
if [ ! -d "$blog_folder" ]; then
23-
echo "Error: The blog folder does not exist."
24-
exit 1
23+
echo "Error: The blog folder does not exist."
24+
exit 1
2525
fi
2626

2727
blog_content_folder="${BLOG_CONTENT_FODLER:-/graph}"
@@ -48,7 +48,8 @@ cp -R "$export_folder/logseq-pages"/* "$pages_destination/"
4848
cp -R "$export_folder/logseq-assets"/* "$assets_destination/"
4949

5050
# replace the /logseq-asstes/ paths with the hugo image folder
51-
find "$pages_destination" -type f -exec sed -i '' -e "s@/logseq-assets/@$images_folder/@g" {} \;
52-
find "$pages_destination" -type f -exec sed -i '' -e "s@/logseq-pages/@$blog_content_folder/@g" {} \;
51+
find "$pages_destination" -type f -exec sed -i.bak -e "s@/logseq-assets/@$images_folder/@g" {} \;
52+
find "$pages_destination" -type f -exec sed -i.bak -e "s@/logseq-pages/@$blog_content_folder/@g" {} \;
53+
rm -f "$pages_destination"/*.bak
5354

5455
echo "Content moved successfully."

0 commit comments

Comments
 (0)