Thanks Paul, that's exactly what I really need to do. 

On Tuesday, December 8, 2015 at 8:51:26 PM UTC-5, Paul Borman wrote:
>
> It really depends on what you are trying to do with the file name, as 
> indicated by other posters.  If you really are creating a command line that 
> is to be directly parsed by bash then you can put the name in single quotes 
> for the most part.  The exception is if you want a single quote, but that 
> is not hard.  If you have the name %bob's file then it would become  
> '%bob'"'"'s 
> file'.  See http://play.golang.org/p/ntk8EEGjfk for an example of how to 
> do that.  But are you really sure you need to do this?
>
> On Tue, Dec 8, 2015 at 5:00 PM, Jesse McNelis <[email protected] 
> <javascript:>> wrote:
>
>> On Wed, Dec 9, 2015 at 11:27 AM, gocss <[email protected] 
>> <javascript:>> wrote:
>> > Is there a function that I can pass a unix filename string too
>> > which will escape characters that may cause issues when invoking bash ??
>> >
>> > example filename: 12%3!4"3 '< [> 3 |.txt
>> >
>>
>> It's best to avoid invoking a shell if you can, much better to just
>> invoke the programs you want to run directly from Go.
>> If you're invoking programs directly from Go then you won't need to
>> escape the filename. You can just pass it in as an arg.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to