LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Passing arguments containing spaces

[ILUG] Passing arguments containing spaces

Liam O'Hagan liam at liamohagan.com
Fri Dec 30 16:03:18 GMT 2005


On Fri, Dec 30, 2005 at 03:00:31PM +0000, kae verens wrote:


> try escaping the backslash as well:
> 
> command="mp3info -a \\\"Louis Armstrong\\\" -l \\\"The Essential Louis\\\" 
> -t \
>  \\\"Basin Street Blues\\\" \\\"Basin Street Blues.mp3\\\""
> 
> Kae


Hi Kae,

Thanks for the reply.

Perhaps I should have been more verbose in my original post.
The escaped characters in the example I gave were escaped double-quotes
so that my parameters would be quoted in the variable.

A more detailed example with a shorter command would probably be more helpful :

1. $ mp3info "Tiger Rag.mp3"  
   $ Tiger Rag.mp3 does not have an ID3 1.x tag.

   Perfect result.


2. $ command="mp3info \"Tiger Rag.mp3\""
   $ echo $command
   $ mp3info "Tiger Rag.mp3"

   As you can see, I've escaped the double quotes to replicate the command in 1.


3. $ $command
   $ Error opening MP3: "Tiger: No such file or directory
   $ Error opening MP3: Rag.mp3": No such file or directory

   bash has split the quoted parameter into two single-word parameters.


4. $ command="mp3info \"Tiger\\ Rag.mp3\""
   $ echo $command
   $ mp3info "Tiger\ Rag.mp3"

   I've escaped the space in the filename


5. $ $command
   $ Error opening MP3: "Tiger\: No such file or directory
   $ Error opening MP3: Rag.mp3": No such file or directory

   with no change in behaviour.


I had thought about renaming all the files to remove the spaces and replace
them with underscores, but I'd be left with the same problem trying to set the
artist name and album name.


I remain puzzled !



Regards,


Liam


-- 
Liam O'Hagan
GPG Key : http://www.liamohagan.com/gpg/
Key ID  : 5064DEA3



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell