1

So I have been working on a little script to alert me when an artist releases a new album using amazon and elinks.

Problem is that for some reason elinks will stop half way through the -dump command and not finish. Hopefully someone can see what I am missing.

An example of the command I am using is:

elinks -dump https://www.amazon.com/s/ref=sr_nr_p_lbr_music_artists__0?fst=as%3Aoff&rh=i%3Aaps%2Ck%3Athe+prodigy%2Cp_lbr_music_artists_browse-bin%3AThe+Prodigy&keywords=the+prodigy\&ie=UTF8&qid=1466468403&rnid=3458810011 > artist.cache

For reference I plan on sending this through a loop that will go through a file and search all the artist on the list like so (note the $artist)

https://www.amazon.com/s/ref=sr_nr_p_lbr_music_artists__0?fst=as%3Aoff&rh=i%3Aaps%2Ck%3A$artist%2Cp_lbr_music_artists_browse-bin%3A$artist&keywords=$artist&ie=UTF8&qid=1466468403&rnid=3458810011

Then its just going to use grep and date to post the matching line and artist/album to a text file.

So if anyone sees what I am doing wrong I will appricate the help, or if you have an easier idea of how to do get the text from the webpage to a file please let me know as well.

Thanks,

cas
  • 1
  • 7
  • 119
  • 185
NeonLines
  • 13
  • 2

1 Answers1

2

If you do not quote the parameter, the "&" in the parameter will put part of this into the background, and run an incomplete command.

Something like this:

> elinks -dump 'https://www.amazon.com/s/ref=sr_nr_p_lbr_music_artists__0?fst=as%3Aoff&rh=i%3Aaps%2Ck%3Athe+prodigy%2Cp_lbr_music_artists_browse-bin%3AThe+Prodigy&keywords=the+prodigy\&ie=UTF8&qid=1466468403&rnid=3458810011' > artist.cache

The escaped "&" (\&) looks as if you noticed the problem, but it is simpler (and more complete) to just quote the whole parameter.

Thomas Dickey
  • 75,040
  • 9
  • 171
  • 268
  • Sorry meant to reply to this earlier but I have been very busy. I haven't had a change to test it fully with the script but I just ran the command on my server box since I'm at work and it looks to do exactly what I was hoping. Thank you very much – NeonLines Jun 22 '16 at 08:15