#3 Shell expansion

Abierta
abierta hace 8 años por zPlus · 2 comentarios
zPlus comentado hace 8 años

Shell expansion doesn't work really well... If I have a local folder of .pls files, I can use something like

name>Name
url>/home/zplus/radios/epic\ rock\ radio.pls

but this instead doesn't seem to work

name>Name
url>~/radios/epic\ rock\ radio.pls

also names without escape characters don't seem to work.

Shell expansion doesn't work really well... If I have a local folder of `.pls` files, I can use something like name>Name url>/home/zplus/radios/epic\ rock\ radio.pls but this instead doesn't seem to work name>Name url>~/radios/epic\ rock\ radio.pls also names without escape characters don't seem to work.
zPlus comentado hace 8 años
Autor

By the way, I think the format of your .radiolist is a bit too complex... Is there a reason to use that format? Why not a simpler list like this

Name 1    |    url_1
Name 2    |    url_2
Name 3    |    url_3
...

then you can just parse each line to retrieve (Name, URL) pairs

while IFS='|' read -r col_1 col_2; do
    # Trim white spaces
    col_1=`echo $col_1 | sed 's/[ \t]*//'`
    col_2=`echo $col_2 | sed 's/[ \t]*//'`

    echo "$col_1"
    echo "$col_2"
done < radiolist_file
By the way, I think the format of your `.radiolist` is a bit too complex... Is there a reason to use that format? Why not a simpler list like this Name 1 | url_1 Name 2 | url_2 Name 3 | url_3 ... then you can just parse each line to retrieve (Name, URL) pairs while IFS='|' read -r col_1 col_2; do # Trim white spaces col_1=`echo $col_1 | sed 's/[ \t]*//'` col_2=`echo $col_2 | sed 's/[ \t]*//'` echo "$col_1" echo "$col_2" done < radiolist_file
kzimmermann comentado hace 8 años
Propietario

That's a good idea!

I mostly chose the < character because I wanted to avoid characters commonly available in URLs like =, but this seems to be a more logical idea indeed. Every line is an entry.

That's a good idea! I mostly chose the `<` character because I wanted to avoid characters commonly available in URLs like `=`, but this seems to be a more logical idea indeed. Every line is an entry.
Inicie sesión para unirse a esta conversación.
Sin etiquetas
Sin Milestone
Sin asignado
2 participantes
Cargando...
Cancelar
Guardar
Aún no existe contenido.