As you can see, the double quotes are processed by bash and summarily ignored.
While i could go and escape every single quote in the codebase, i would rather not.
I've tried changing the execution format to eval, exec, weird subshells, using $@ instead of $*, and im out of ideas.

Does anyone know how this could be accomplished?

Kenhelm

06-18-2009 08:22 PM

"$@" gives all the arguments on the command line individually quoted "$1" "$2" ....
The demonstration below needs a file 'aa aa' in the current directory.
The file name is listed to sed which then changes all the a's to b's.

Code:

function run() {
"$@" | sed 's/a/b/g'
}
run ls "aa aa"

# Output
bb bb

# If $@ is used instead of "$@" the output is
ls: aa: No such file or directory
ls: aa: No such file or directory

GrapefruiTgirl

06-18-2009 09:45 PM

Add more quotes !

Quote:

...Which works fine for one or two cases, but applying this accross the board i would rather do this in a globally defined function, like