spaces in the path

Benjamin Reed rangerrick at gmail.com
Tue Apr 11 18:48:15 CEST 2006


On 4/11/06, Alexander Neundorf <neundorf at kde.org> wrote:

> I was not able to write a shell script which forwards its arguments to a
> program it calls:
>
> #!/bin/sh
>
> dcopidl2cpp $@

it should be dcopidl2cpp "$@"

It looks weird, but "$@" will give you proper space-separated args.

ranger$ cat <<END >/tmp/foo.sh
> #!/bin/sh
>
> for arg in "\$@"; do
>   echo "arg = \$arg"
> done
> END
ranger$ sh /tmp/foo.sh "arg 1" "arg 2" arg 3
arg = arg 1
arg = arg 2
arg = arg
arg = 3
ranger$


More information about the Kde-buildsystem mailing list