I want a bash function that turns this …
download HELLO&P=1&Q=2
into this …
aria2c -d ~/Downloads "HELLO&P=1&Q=2"
HELLO&P=1&Q=2
is a MAGNET link. If it doesn’t have double quotes around it, aria2c doesn’t work. But I can’t seem to keep it all together. The problem seems to be that the MAGNET link has series of &key=value
pairs at the end (in my example &P=1&Q=2
) and these seem to be getting stripped out and separated from the rest of the link (i.e. HELLO
).
Here is my .bash_profile
function.
download() {
aria2c -d ~/Downloads "$1"
}
Here are is a sample output.
~ $ download HELLO&P=1&Q=2
[1] 7389
[2] 7390
aria2c -d /Users/lukejanicke/Downloads HELLO
[1]- Done download HELLO
[2]+ Done P=1
~ $
No even sure where Q=2
went. With real MAGNET links, all the parts are displayed in this enumerated way.
I need some way of capturing the whole MAGNET link as a single parameter and then executing the aria2c
command with quotes around the link.