I have this command that does what I want but I can't get to alias it in my .bashrc (note that it uses both single and double quotes):
svn status | awk '$1 =="M"{print $2;}'
I've tried:
alias xx="svn status | awk '$1 ==\"M\"{print $2;}'"
And some other common sense combinations with no luck.. I know that bash is very picky with quotes.. So what's the correct way to alias it and why ? Thanks
If it's bash , variables need to be quoted. In a function, no need to put everything on one line. Show activity on this post. It's simply done by finishing already opened one ( ' ), placing escaped one ( \' ), then opening another one ( ' ).
An alias can be created with more than two commands. Similar to the two command method multiple commands can be used for an alias. We again use the semi-colon in order to use and separate multiple commands from each other.
Bash users need to understand that alias cannot take arguments and parameters. But we can use functions to take arguments and parameters while using alias commands.
You just need to escape it correctly.
alias xxx="svn status | awk '\$1 ==\"M\"{print \$2;}'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With