[Server-devel] Fixing bash script bogosity - help?
Martin Langhoff
martin.langhoff at gmail.com
Tue Apr 28 07:07:12 EDT 2009
On Tue, Apr 28, 2009 at 1:01 PM, Ignacio Vazquez-Abrams
<ivazqueznet at gmail.com> wrote:
> Which part of the following doesn't work?
Just test your minimal 3 line script with the example input I've given
you. It breaks:
# cat > sample.sh
#! /bin/bash
CMD=(touch "$@")
bash -c "${CMD[@]}"
# ./sample.sh "this is file one" "this is file two" "file
>
# bash -x ./sample.sh "this is file one" "this is file two" "file \" f"
+ CMD=(touch "$@")
+ bash -c touch 'this is file one' 'this is file two' 'file " f'
touch: missing file operand
Try `touch --help' for more information.
Bash (line runuser) expects a line of shell, quoted/escaped
appropriately, as a single string param -c
*that* is the challenge.
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 Server-devel
mailing list