0

I currently have the following regex inside a shell script which kills a process matching a certain regex, which works ok:

 killall --regexp 'docker(.*?)[logs\ \-f\ liberty]$'

I'm trying to change the last part, basically instead of the string 'liberty', have it match the command line argument 1 to the script.. I read that the '\' character can escape things inside regex, so I tried the following but didn't have any luck:

  killall --regexp 'docker(.*?)[logs\ \-f\ \$1]$'

Am I not escaping it properly or do I need to store it in a temp variable etc. ?

Pete
  • 1,500
  • 2
  • 16
  • 33

0 Answers0