[Server-devel] Fixing bash script bogosity - help?

Ignacio Vazquez-Abrams ivazqueznet at gmail.com
Tue Apr 28 03:27:00 EDT 2009


On Mon, 2009-04-27 at 22:37 +0200, Martin Langhoff wrote:
> Hi all,
> 
> I have a simple shell scripting problem :-) you'll find attached a
> shell script that ships with ejabberd. It is a fairly straightforward
> bit of code, and allows us to control bits of the ejabberd internals
> with a nice cli interface. (Feel free to skip the start / stop bits of
> the code, I'm fighting with the ctrl function.)
> 
> The problem it has is that the parameters are passed to a bash or
> runas invocation -- at which point the quoting is a mess. Currently I
> am working around it in the caller by doing some stupid
> nested-quoting. But this should be easy to cure -- if anyone knows a
> bit more bash (or portable shell!) than me :-)
> 
> A minimal exposition of the problem is as follows:
> 
> $ cat sample.sh
> #!/bin/bash -x
> 
> # in the script, the CMD is built up as a string
> CMD="touch $@"

http://mywiki.wooledge.org/BashFAQ/050

-- 
Ignacio Vazquez-Abrams <ivazqueznet at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.laptop.org/pipermail/server-devel/attachments/20090428/68af214d/attachment.pgp 


More information about the Server-devel mailing list