LukeSmithxyz / lb

Blog & RSS system in less than 100 lines of shell script
GNU General Public License v3.0
280 stars 81 forks source link

If a blog post page contains numerical digit(s), it can throw off revising a blog entry #40

Closed QDesjardin closed 4 years ago

QDesjardin commented 4 years ago

One of my pages happens to be titled "Season 3 nostalgia," and I wanted to revise post 3, "Scary Dairy." This is what happens:

pic-select-202007-1554-02

Basically, nothing shows up in the text editor because lb has concatenated the titles of "Season 3 Nostalgia" with "Scary Dairy." This happens because of the command:

chosen="$(ls -rc "$1" -I '*[^".html"]' -I "index.html" | nl | grep -w " $number" | awk '{print $2}')"

where grep -w "$number" ends up selecting two pages at once:

pic-select-202007-1551-54

However, modifying the grep command to include a preceding space before $number: grep -w " $number" fixes the issue.