commit 33ba59ca4d25635d6e5743869a34251646dcbc59
parent 30db50c128ec23c29ff2a2b585ff25fbecbf9caf
Author: St John Karp <contact@stjo.hn>
Date: Sat, 27 Jun 2020 04:14:49 -0500
Remove one extra sed command by printing from find
Removed an extra sed command by printing the file names from find
without the starting point.
Diffstat:
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/squeeze.sh b/squeeze.sh
@@ -12,10 +12,9 @@ rsync --archive --delete --verbose \
"$SOURCE_PATH/" "$OUTPUT_PATH/"
# Parse and create all the HTML files.
-find "$SOURCE_PATH" -type f -name "*.md" -print0 |
- sed "s|$SOURCE_PATH/||g" |
+find "$SOURCE_PATH" -type f -name "*.md" -printf "%P\0" |
sed "s|\.md||g" |
- xargs --null --max-procs 99 -I % sh -c "echo \"%\" &&
+ xargs --null --max-procs 99 -I % sh -c "echo '%' &&
swipl --traditional --quiet -l parse_entry.pl -g \"consult('$SITE_PATH/site.pl'), generate_entry('$SOURCE_PATH/%.md').\" |
smartypants \
> \"$OUTPUT_PATH/%.html\""
diff --git a/unsqueeze.sh b/unsqueeze.sh
@@ -13,10 +13,9 @@ rsync --archive --delete --verbose \
"$OUTPUT_PATH/" "$SOURCE_PATH/"
# Parse and create all the Markdown files.
-find "$OUTPUT_PATH" -type f -name "*.html" -print0 |
- sed "s|$OUTPUT_PATH/||g" |
+find "$OUTPUT_PATH" -type f -name "*.html" -printf "%P\0" |
sed "s|\.html||g" |
- xargs --null --max-procs 99 -I % sh -c "echo \"%\" &&
+ xargs --null --max-procs 99 -I % sh -c "echo '%' &&
swipl --traditional --quiet -l parse_entry.pl -g \"consult('$SITE_PATH/site.pl'), parse_entry('$OUTPUT_PATH/%.html').\" \
> \"$SOURCE_PATH/%.md\""