-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I have a script (from somebody else) to download the image of the day from the NASA. I have modified the script quite a bit to download a range of days, even years of them. One key function is failing on today's picture. This is the relevant section of the script: +++...................... function get_page { echo "Downloading page to find image" #wget http://apod.nasa.gov/apod/ --quiet -O /tmp/apod.html wget https://apod.nasa.gov/apod/ap${SHORT_TODAY}.html --quiet -O /tmp/apod.html grep -m 1 jpg /tmp/apod.html | sed -e 's/<//' -e 's/>//' -e 's/.*=//' -e 's/"//g' -e 's/^/http:\/\/apod.nasa.gov\/apod\//' > /tmp/pic_url } get_page # Got the link to the image PICURL=`/bin/cat /tmp/pic_url` if [ -z $PICURL ]; then echo "Not found picture.jpg for $TODAY. Trying .png" try_png PICURL=`/bin/cat /tmp/pic_url` if [ -z $PICURL ]; then echo "Not found picture.png for $TODAY. html file saved" cp /tmp/apod.html $PICTURES_DIR/$TODAY.html return fi fi NAME=`basename $PICURL` PICTURE_NAME=${TODAY}_${NAME} ......................++- The script sets up variable SHORT_TODAY to 230427, so "get_page" downloads <https://apod.nasa.gov/apod/ap230426.html>. It is coughing up this error: Do 20230427 Downloading page to find image /home/cer/bin/NASA Picture-Of-The-Day Wallpaper Script, mine, loop: line 98: [: too many arguments basename: extra operand ‘Tarantula</a>’ Try 'basename --help' for more information. The problem is here: cer@Isengard:~> grep -m 1 jpg /tmp/apod.html | sed -e 's/<//' -e 's/>//' -e 's/.*=//' -e 's/"//g' -e 's/^/http:\/\/apod.nasa.gov\/apod\//' http://apod.nasa.gov/apod/image/1602/Tarantula-HST-ESO-annotated1800.jpgArou... the Tarantula</a> cer@Isengard:~> The source html goes like this: <a href="image/1602/Tarantula-HST-ESO-annotated1800.jpg">Around the Tarantula</a> are other star forming regions with young star clusters, filaments, and blown-out <a href="ap080327.html">bubble-shaped</a> clouds. On the day before, it goes like this (here the script works as expected): 2023 April 26 <br> <a href="image/2304/MoonArc_zanarello_1365.jpg"> <IMG SRC="image/2304/MoonArc_zanarello_960.jpg" alt="A nearly full Moon is seen through the famous Arc de Triomphi with trees and cars lining the foreground. Please see the explanation for more detailed information." style="max-width:100%"></a> </center> where the function generates this text: cer@Isengard:~> echo '<a href="image/2304/MoonArc_zanarello_1365.jpg">' | grep -m 1 jpg | sed -e 's/<//' -e 's/>//' -e 's/.*=//' -e 's/"//g' -e 's/^/http:\/\/apod.nasa.gov\/apod\//' http://apod.nasa.gov/apod/image/2304/MoonArc_zanarello_1365.jpg cer@Isengard:~> My problem is, I don't talk sed O:-) So, I ask here if someone knows how to change that sed command so that it works ;-) (the full script I modified is: https://paste.opensuse.org/7f484bb7c807) - -- Cheers Carlos E. R. (from 15.4 x86_64 at Telcontar) -----BEGIN PGP SIGNATURE----- iHoEARECADoWIQQZEb51mJKK1KpcU/W1MxgcbY1H1QUCZErjCRwccm9iaW4ubGlz dGFzQHRlbGVmb25pY2EubmV0AAoJELUzGBxtjUfV7RYAnR1jKw8AXonj2E837r7L cY3g08VvAJ418VFrG/lGU3gad7PPUwFceZIfIg== =KHba -----END PGP SIGNATURE-----