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

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
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

kevin lyda kevin at ie.suberic.net
Fri Dec 30 17:02:26 GMT 2005


oh dear god.  shell quoting isn't rocket science people.  fine.

for future reference, the best test command for shell escaping is this:

    echo "moo  cow"

if the result is anything other than

moo  cow

there are quoting problems.

On Fri, Dec 30, 2005 at 04:03:18PM +0000, Liam O'Hagan wrote:
> 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.

yes.  because if you're going to craft the entire command by hand you
really should use the eval builtin.

like so: eval "$command"

it would be better if instead of constructing the command by hand you
instead did something like:

    mp3info -flag "some meta info" "a file name"

or

    foo="some meta info"
    file="a file name"
    mp3info -flag "$foo" "$file"

kevin



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