substitute variables in command