1

I am writing a bash script to achieve the output of replacing the content in abc.txt file

#! /bin/bash/

echo "Please write the file name"

read file

old = "abc"

new = "bcd"

sed -i "s/$old/$new/g" $file

output: I am not getting the result. Please let me know where I did mistakes?

HatLess
  • 10,622
  • 5
  • 14
  • 32
Aktar
  • 11
  • 3
  • `#! /bin/bash/` ? – jhnc Sep 21 '21 at 22:20
  • 1
    [shellcheck.net](https://www.shellcheck.net) will point out several problems with this script. I recommend running your scripts through it and fixing what it points out, at least until you get more experienced at shell scripting. – Gordon Davisson Sep 21 '21 at 22:34

0 Answers0