How to pass command line arguments to yarn script

Viewed 2524

I want to use command line argument and use this value to replace in url in yarn script. My script looks like this -

"demo:req": "curl -s -D - -o /dev/null https://test.com/demo?request=true&type=${0} | grep -i '^location: ' | awk '{print $2}' | sed 's/https/http/' | sed 's/test.com/localhost:3012/'",

So when I run

yarn demo:req type1

it should replace the ${0} with type1 before triggering the curl command. But this is not working.

I tried to use ${TYPE} in url and run the command as

yarn demo:req TYPE=type1

but still no luck.

Any help would be really appreciated

0 Answers
Related