#3 Shell expansion

开启中
zPlus8 年之前创建 · 2 条评论
zPlus 评论于 8 年之前

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 评论于 8 年之前
发布者

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 评论于 8 年之前
所有者

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.
登录 并参与到对话中。
未选择标签
未选择里程碑
未指派成员
2 名参与者
正在加载...
取消
保存
这个人很懒,什么都没留下。