#3 Shell expansion

Open
opened 8 years ago by zPlus · 2 comments
zPlus commented 8 years ago

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 commented 8 years ago
Poster

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 commented 8 years ago
Owner

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.
Sign in to join this conversation.
No Label
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.