How to eval PHP code via drush without escaping quotes routine
Very often there is a need to execute via
drush eval command the PHP code with both single and double quotes, something like this:
<?php echo "Hello, '$username'!"; ?>
This can be quickly done without manually adding slashes to each quote in PHP code via this bash trick:
PHP=`cat <<'EOF' echo "Hello, '$username'!"; EOF`; drush ev "$PHP"
Instead of single line of PHP code, you can insert long multi-line part of code, without carrying about escaping quotes.