P
P
petrov_ruslan2017-10-18 23:55:35
bash
petrov_ruslan, 2017-10-18 23:55:35

Why do symlink names have a question mark at the end and why don't they work?

Made a script

#!/bin/bash
#удаляем старый плейлист
rm /home/osmc/.kodi/userdata/playlists/video/playlist.m3u
#очищаем дирректорию с ссылками
rm /media/FLASH/links/*.mkv
#переменная с путем к файлу от отдела маркетинга
file="/home/osmc/file/file.m3u"
#переменная для именования ссылок
let s=1
#меняем слеши в путях
sed -i 's/\\/\//g' $file
#подстановка правильно пути
sed -i 's!L:/files!/media/FLASH!' $file
#начало построчного чтения файла
while read line
        do
          #проверка того, что строка - путь
          if 
          then
                #создание ссылки
                ln -s $line /media/FLASH/links/$s.mkv
                #запись пути ссылки в плейлист
                echo /media/FLASH/links/$s.mkv >> /home/osmc/.kodi/userdata/playlists/video/playlist.m3u
                let s=s+1
          else
                #запись атрибутов в плейлист
                echo $line >> /home/osmc/.kodi/userdata/playlists/video/playlist.m3u
          fi
        done < $file

Its essence is to get an intermediate playlist from windows, replace the paths, symlink with each path / file and add them to the final playlist.
I create a playlist in vlc, copy it, run the script, it seems to work correctly, but symlinks do not work.
The output of ln -l shows the following.
59e7bf2cd040a888913832.png
Actually the question is why there is a question mark at the end of symlink names and why they don't work?
Despite the fact that if you manually create, everything is OK

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2017-10-19
@petrov_ruslan

why do symlink names have a question mark at the end and why don't they work?

Because you read such file names from $file with the read statement:
That's why they don't work, because some kind of garbage at the end. show what it outputshexdump -Cv $file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question