Expand parameter in quotes in zsh
I want to pass function arguments to zsh’s `emulate` to evaluate a command in bash emulation:
$ .bash() { emulate bash -c "$*" }
$ .bash 'source /path/to/script.sh'
It’s ok but I want this without quotes like a precommand modifier (to use syntax highlighting, completion, etc.) as in
$ .bash source /path/to/script.sh
The problem arises when a command line contains quoted spaces:
$ .bash source /path/to/"script with spaces".sh
$ # I want it to expand to
$ emulate bash -c 'source /path/to/"script with spaces".sh'
$ # or the like
I tried to play with different quotes and with `${(qq)*}` expansion flags. No good so far.
Is there any way to achieve this?