The zsh command returns an error when I use a variable in the parameters

50 Views Asked by At

I'm running a zsh script ./signFiles.

I have the following error when I introduce the $runtime variable in the codesign command :

codesign: unrecognized option `--options runtime'

#!/bin/zsh

[…]

runtime="--options runtime"
codesign --timestamp --force $runtime --prefix="$identifier." -s "$ID_Application_signature" $file

Everything works fine when I hardcode the --options runtime in the command :

codesign --timestamp --force --options runtime --prefix="$identifier." -s "$ID_Application_signature" $file

Doesn't seems so hard to be resolved but I just can't make it work. Any help would be greatly appreciated.

RESOLVED Thanks to the comment of @chepner :

runtime=(--options runtime)
codesign --timestamp --force "${runtime[@]}" ...
0

There are 0 best solutions below