У меня проблемы с передачей переменной с именем $discogs
команде ls
в моем скрипте.
Когда я не запускаю скрипт, я могу повторить переменную и правильно запустить команду в оболочка, однако в скрипте выдает ошибку.
Вот мой код:
echo "I will search for the Artist ID Number and return the Artist Name"
read id
cat file--2020-04-26.xml | grep -A 1 '<artist id="'$id'">' | tail -n 1 | cut -c 9- | rev | cut -c 8- | rev
artist=$(cat file--2020-04-26.xml | grep -A 1 '<artist id="'$id'">' | tail -n 1 | cut -c 9- | rev | cut -c 8- | rev)
discogs=$(curl --silent https://athena.example.com/discogs/get_discogs_id.php?Artist="'$artist'")
echo $artist
echo Discogs ID:
echo $discogs
ls -l /root/athena/scrape/icons/png/"'*'$discogs'*'"
ls -l /root/athena/scrape/icons/png/"*${discogs}*"
Ошибки:
ls: cannot access '/root/athena/scrape/icons/png/'\''*'\'''$'\r\n\r\n\r\n''1103159'\''*'\''': No such file or directory
ls: cannot access '/root/athena/scrape/icons/png/*'$'\r\n\r\n\r\n''1103159*': No such file or directory