Home > Back-end >  Adding a variable to a slack app notification message in a bash script
Adding a variable to a slack app notification message in a bash script

Time:11-18

I have a bash script set up that notifies me through slack when a certain condition is met.

I need it to tell me on which program the condition has been met.

The program name is set as a variable and i cant figure out how to implement the variable within the text of the slack notification

Here is the code:

curl -X POST -H 'Content-type: application/json' --data '{"text":"Blah Blah Blah found on $company"}'

It simply sends the message with the literal of $company, what do i need to add so it send the value within the variable?

Thanks

CodePudding user response:

The single quotes are suppressing variable expansion. Do this:

--data '{"text":"Blah Blah Blah found on '"$company"'"}'
# .......................................^^........^^
  • Related