Oooops, you forgot to post your code.

1) How would I go about escaping specific chars and spaces with a \ ?

Generally with single quotes, rather than character-specific escaping with \. 'this is a single filename'. But that's in the shell, not in Perl... so in Perl you might want single quotes inside your Perl level quotes, something like: </code> system( "/usr/bin/myfavcoverter -flag 'my filename with lame spaces' '$my_scalar_that_holds_a_evil_file_with_funny_characters'" ); </code> Note that it's actually better to split up the arguments to system(), so that it doesn't have to use the shell... please see the documentation for system() for details.

please don't do like I did there and use a scalar that was set from outside the file, like a filename or user input, until you've read and understand all of the perlsec man page( perldoc perlsec ). Otherwise, you'll be creating a security hole. But for converting media files, it's probably not really an issue, unless you're going to allow others to use it. For example, placing it in /usr/bin on a system with other users...

2) Which characters in a UNIX file name must be escaped?

That depends on which shell you're using. /bin/sh is usually bash, so "man bash" will help there. Or, just put it all in single quotes to cheat until you learn the details... ;)

3) And finally, after everything is coded and functioning, how would I go about making it excuteable from /usr/bin (or wherever) so that i can just call the name of the program and have it run?

assuming the first line of your Perl program is  #!/usr/bin/perl then you'll only need to do chmod a+x myperlscript

update: I use the program xcdroast for all my linux cd burning joys. You might want to also look at gtoaster.


--
Snazzy tagline here

In reply to Re: Escaping characters in a file name by Aighearach
in thread Escaping characters in a file name by emilford

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.