fork(3) download
  1. #!/bin/bash
  2. s="TEST=bla
  3. TEST_2=blabla
  4. TEST=bla4"
  5. t="This is some fake config file. The value of test variable is %TEST%."
  6.  
  7. repl="$(sed -n 's/^TEST=\(.*\)/\1/p;q' <<< "$s")"
  8. sed "s|%TEST%|$repl|g" <<< "$t"
  9.  
  10. sed "s|%TEST%|$(sed -n 's/^TEST=\(.*\)/\1/p;q' <<< "$s")|g" <<< "$t"
Success #stdin #stdout 0s 4188KB
stdin
Standard input is empty
stdout
This is some fake config file. The value of test variable is bla.
This is some fake config file. The value of test variable is bla.