#Path where to store 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.


1 Answer 1

printf "$QUTE_URL $*\n"

This will want to consume (nonexistent) arguments if the expansion contains a % format specifier, such as %c, %d or %f.

Instead use printf '%s\n' "$QUTE_URL $*" or echo "$QUTE_URL $*".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.