Reputation: 693
I am writing a bash script that uses sed and I am trying to a variable to $db, but $db has ` around it. This keeps me from being able to pass it the variable.
sed -n '/^-- Current Database: `$db`/,/^-- Current Database: `/p' $path$infile > $path$outfile.sql
Thanks for your help
Upvotes: 0
Views: 159
Reputation: 5973
Wrap the sed script in double rather than single quotes, and use backslashes to escape the backticks:
sed -n "/^-- Current Database: \`${db}\`/,/^-- Current Database: \`/p" $path$infile > $path$outfile.sql
Upvotes: 1