Fix exclusion logic to preserve original filename format for grep filter
This commit is contained in:
parent
22cc7e0872
commit
fb86ccd1a7
1 changed files with 3 additions and 1 deletions
|
|
@ -67,8 +67,10 @@ fi
|
||||||
EXCLUDE_FILE=""
|
EXCLUDE_FILE=""
|
||||||
if [ "$IS_DIR" = true ] && [ "$SKIP_MOST_RECENT" = true ]; then
|
if [ "$IS_DIR" = true ] && [ "$SKIP_MOST_RECENT" = true ]; then
|
||||||
# Find the most recent file by filename date (format: YYYY_MM_DD.md or YYYY-MM-DD.md)
|
# Find the most recent file by filename date (format: YYYY_MM_DD.md or YYYY-MM-DD.md)
|
||||||
|
# We need to keep the original filename for the grep filter
|
||||||
EXCLUDE_FILE=$(find "$TARGET" -maxdepth 1 -name '*.md' -type f | \
|
EXCLUDE_FILE=$(find "$TARGET" -maxdepth 1 -name '*.md' -type f | \
|
||||||
sed 's/.*\///' | sed 's/_/-/g' | sort -r | head -1)
|
sed 's|.*/||' | sed 's/_/-/g' | sort -r | head -1 | \
|
||||||
|
sed 's/-/_/g')
|
||||||
if [ -n "$EXCLUDE_FILE" ]; then
|
if [ -n "$EXCLUDE_FILE" ]; then
|
||||||
echo "Excluding most recent file: $EXCLUDE_FILE"
|
echo "Excluding most recent file: $EXCLUDE_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue