~/snippets/cpn-eval-stored-command-variables
Published on

Evaluate a stored command with variables

143 words1 min read
$ cpn get --id 5 --format json | jq -r
{
  "id": 5,
  "title": "params test",
  "description": "echo Hello $TYPE, my name is $NAME",
  "createTimestamp": "2023-08-10 12:40:39"
}

$ TYPE=World NAME=bob eval $(cpn get --title "params test" -f json | jq -r '.description')
Hello World, my name is bob