bash alias command with both single and double quotes
Here's something that accomplishes the same thing without using an alias. Put it in a function in your .bashrc:
xx() {
svn status | awk '$1 =="M"{print $2;}'
}
This way you don't have to worry about getting the quotes just right. This uses the exact same syntax you would at the command line.
You just need to escape it correctly.
alias xxx="svn status | awk '\$1 ==\"M\"{print \$2;}'"
Since Bash 2.04 there is a third (easier) way beside using a function or escaping the way @ffledgling did: using string literal syntax (here is an excellent answer).
So for example if you want to make an alias of this onliner it will end up being:
alias snap-removedisabled=$'snap list --all | awk \'$5~"disabled"{print $1" --revision "$3}\' | xargs -rn3 snap remove'
So you just have to add the $
in front of the string and escape the single quotes.
This brings a shellcheck warning you could probably safely disable with # shellcheck disable=SC2139
.