-1

I am writing a bash script for installing django with postgresql database automatically. Now , I want to replace database name by command ,since it is using sqlite3 database file path.

I wrote this command:

sudo sed -i "s/ALLOWED_HOSTS = []/ALLOWED_HOSTS = ['*']/g"  $project_name/settings.py

But it shows me this error:

sed: -e expression #1, char 44: unterminated `s' command

How to change this , please help me.

Inian
  • 80,270
  • 14
  • 142
  • 161
HM Tanbir
  • 990
  • 12
  • 30

1 Answers1

1

Escape the single-quotes as below:-

sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \['*'\]/g" file
Inian
  • 80,270
  • 14
  • 142
  • 161