I'm making a declarative Jenkins pipeline which has a for loop to iterate over the output of a bash command. In that command it is necessary to use bash arguments e.g. "$1" for first argument. And it is a series of pipes with many types of quotes.
I tried using the triple double quotes for a raw string in groovy but it seems groovy is still trying to parse "$1" as me trying to reference the value of a variable named "1". So, this is not expected "raw string" behavior.
How does one go about doing this?
Here's an example of what the command is like.
kubectl get namespaces --no-headers -o=custom-columns=":.metadata.name,:.metadata.creationTimestamp" | grep -E "myproject_" | awk '$2 <= "'$(date -d'now-2 days' -Ins --utc | sed 's/+0000/Z/')'"{print $1}' | sed 's/myproject_//g'"""
Ignore the specifics of the command. My question is purely how does one get around the dollar sign syntax errors. The actual command is something different.