Fixing bash script bogosity - help?

Martin Langhoff martin.langhoff at gmail.com
Tue Apr 28 05:17:48 EDT 2009


On Tue, Apr 28, 2009 at 9:27 AM, Ignacio Vazquez-Abrams
<ivazqueznet at gmail.com> wrote:
>> # in the script, the CMD is built up as a string
>> CMD="touch $@"
>
> http://mywiki.wooledge.org/BashFAQ/050

That repeats what we know already. The thing is that we are building
the command as a string for runuser, which wants it as a parameter.

It is an interesting question, I think. Can you make my sample script
work, while still handling $CMD as a string? Some sample input for the
challenge:

$ ./sample.sh ./sample.sh "this is file one" "this is file two" "file
with doublequotes \" in it"

cheers,



m
-- 
 martin.langhoff at gmail.com
 martin at laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff



More information about the Devel mailing list