Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

thorny script argument escaping problem



> That would be nice BUT I would need to dynamically create a list of
> arguments for the system method.  If I pass in a string (a
> comma-separated list of quoted arguments), the system() method treats
> that as ONE argument.

Yes, and I am suggesting that instead of passing a string you pass it a
list.  I don't know any ruby, but in python or perl you'd do this by
appending elements to your list until you have what you want.

After spending a few minutes looking at the ruby docs, it looks like you
could:

  cmd = [ '/my/command' ]
  cmd.push('an argument with spaces')
  cmd.push('"an argument with spaces and quotation marks"')
  cmd.push('an argument with <weird shell metacharacters>')

  Kernel.system(*cmd)

-- Lars





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org