RFC: shell-safe version of string_sub()?

Peter Samuelson peter at cadcamlab.org
Thu Oct 19 15:41:27 GMT 2000

[Jean Francois Micouleau <Jean-Francois.Micouleau at dalalu.fr>]
> IMNSHO, %J substitution shouldn't be mangled at all. IIRC, this
> mangling is from previous printing database time.

You mean from back when the print job name was also the filename?  That
makes sense.

> The only mangling that should happen is adding quotes around the
> string.

Sounds great but it's not quite *that* simple:

- if you use '' to quote, you'll need to quote the ' character -- and
  in the Bourne shell the only way is with a construct such as '\'':

    input:  job name with ' in it
    output: 'job name with '\'' in it'

- if instead you use "" to quote, you still have characters you have to
  deal with: " ` $ \

This second option is probably easier.


More information about the samba-technical mailing list