Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
sed を使用する bash スクリプトを作成していて、変数を $db にしようとしていますが、$db の前後に ` があります。これにより、変数を渡すことができなくなります。
sed -n '/^-- Current Database: `$db`/,/^-- Current Database: `/p' $path$infile > $path$outfile.sql
ご協力いただきありがとうございます
sed スクリプトを一重引用符ではなく二重引用符で囲み、バックスラッシュを使用してバッククォートをエスケープします。
sed -n "/^-- Current Database: \`${db}\`/,/^-- Current Database: \`/p" $path$infile > $path$outfile.sql