I created a key with the help of coinstring, then I imported it into my wallet. Then I ran:
bitcoin-cli signrawtransactionwithkey "$rawtxhex" "("$mykey$")"
But it follows:
Unable to sign input, invalid stack size (possibly missing key)
mykey is not really a variable, I codify it hard in my particular case, so I know it is present.