#!/bin/sh
#Path where to store saved urls.
URL_FILE="$QUTE_CONFIG_DIR/saved_urls"
#Arguments are appended to the url (ie for comments)
printf "$QUTE_URL $*\n" >> "$URL_FILE"
printf "tab-close" >> "$QUTE_FIFO"
I often have lot of tabs open, so thought it'd be useful to make a script to do this.
I don't feel very comfortable hardcoding the URL_FILE
path, since it could happen that there was already such a file in that directory with that name, so I feel it's a bad practice, but not sure what to do instead. I'm also concerned about potential corruption of the file where I'm saving the URLs, but making this automatically backup seems like too much effort for such a simple script.
Also, I made it so additional arguments are appended as "comments" at the end of line of each URL. The simple syntax I used has the side effect that running it with no arguments results in a empty space at end of each line. It could be fixed but it'd make the code uglier; I'm not sure what's the best practice here.