mirror of
https://github.com/srid/nixos-config.git
synced 2025-12-26 15:04:59 +08:00
ae: /tmp
This commit is contained in:
parent
8f49564904
commit
7adfa9cc59
1 changed files with 8 additions and 8 deletions
|
|
@ -21,25 +21,25 @@ User wants to:
|
|||
|
||||
```bash
|
||||
# Download HTML
|
||||
curl -L "$URL" > temp.html
|
||||
curl -L "$URL" > /tmp/temp.html
|
||||
|
||||
# Extract article
|
||||
reader temp.html > temp.txt
|
||||
reader /tmp/temp.html > /tmp/temp.txt
|
||||
|
||||
# Get title from first line
|
||||
TITLE=$(head -n 1 temp.txt | sed 's/^# //')
|
||||
TITLE=$(head -n 1 /tmp/temp.txt | sed 's/^# //')
|
||||
|
||||
# Clean filename
|
||||
FILENAME=$(echo "$TITLE" | tr '/:?"<>|' '-' | cut -c 1-80 | sed 's/ *$//')".txt"
|
||||
FILENAME=$(echo "$TITLE" | tr '/:?"<>| ' '-' | cut -c 1-80 | sed 's/-*$//')".txt"
|
||||
|
||||
# Save
|
||||
mv temp.txt "$FILENAME"
|
||||
mv /tmp/temp.txt "/tmp/$FILENAME"
|
||||
|
||||
# Clean up
|
||||
rm temp.html
|
||||
rm /tmp/temp.html
|
||||
|
||||
# Show preview
|
||||
echo "✓ Saved: $FILENAME"
|
||||
head -n 10 "$FILENAME"
|
||||
echo "✓ Saved: /tmp/$FILENAME"
|
||||
head -n 10 "/tmp/$FILENAME"
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue