0
#!/bin/bash

Read a
Read b
Sed -i 's/$a/$b/' txt.txt

I have also use double quotes but it is not working

Cyrus
  • 84,225
  • 14
  • 89
  • 153
  • 2
    *I have also use double quotes but it is not working* - Please show a test case. – Wiktor Stribiżew Apr 08 '20 at 10:44
  • See: [Difference between single and double quotes in bash](http://stackoverflow.com/q/6697753/3776858) – Cyrus Apr 08 '20 at 10:47
  • you also have to ensure that the values in those variables do not conflict with delimiter and you might have to escape metacharacters depending on your use case.. see the answer and links in https://stackoverflow.com/questions/7680504/sed-substitution-with-bash-variables – Sundeep Apr 08 '20 at 10:58

0 Answers0