Re: [SLUG] mplayer and symbols in file name

From: Kwan Lowe (kwan@digitalhermit.com)
Date: Mon May 10 2004 - 17:29:34 EDT


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> In my qwest to convert my .wma files to .ogg I'm a bit closer now, having
> replaced thousands of spaces with underscore.
>
> If I try to play a song from a script like this:
>
> song="/home/s/MyMusic/mohmp3/enya.mp3"
> mplayer "$song"
>
> It does not work. From the cmdline I can type
>
> mplayer /home/s/MyMusic/mohmp3/enya.mp3
>
> it plays fine.
>
> - From there you can also easily read the var $song and execute it with or
> without quotes. So the script is obviously the problem. I've googled all
> over but not found anyone who's run into the same problem...
>
> Mplayers documentation says nothing about running it from a script, but
> before subscribing to yet another list I thought I'd check if someone here
> had run into this.

In addition to the other posts:

#/bin/sh

song="/home/johndoe/outfile"
file ${song}

export IFS='&'
song="/home/johndoe/mp3/buffy/Bif Naked - Lucky.mp3"
file ${song}

The first uses the {} to separate the variable name from other fields. Useful
in certain circumstances. I always do so as a matter of course.

The second sets the Internal Field Separator to a non-whitespace character.
This is useful for filenames with spaces. It beats using multiple escape ("\")
sequences.

-- 
* The Digital Hermit   http://www.digitalhermit.com
* Unix and Linux Solutions   kwan@digitalhermit.com
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:05:23 EDT