2

What is the right command for:

sudo sed -i '/, false);/adefine( 'WP_MEMORY_LIMIT', '64M' );' /var/www/html/wp-config.php

The result is:

define( WP_MEMORY_LIMIT, 64M );

instead of the desired:

define( 'WP_MEMORY_LIMIT', '64M' );
  • What happens here, is that the second single-quote ends the quotation, and WP_MEMORY_LIMIT just goes as an unquoted string to sed. No problem with that, since it's just non-special characters. But the quotes do not nest. But you could put double-quotes(") inside single-quotes(') and the other way around. – ilkkachu Jul 22 '16 at 12:49
  • Hint: look at the automatic coloring of the code in your question. – Gilles Jul 22 '16 at 23:53
4

Try double quotes for the outer ones:

sed -i "/, false);/adefine( 'WP_MEMORY_LIMIT', '64M' );"
  • 7
    @victor212 If this answer solved your issue, please take a moment and accept it by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites. – terdon Jul 22 '16 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.