lundi 22 décembre 2014

Escape single quote in command in alias Terminal


I am working with SVN for version control, and whenever I'm ready to commit some changes, I have to stage them all with the following command:


svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add


As you can see, it's quite complicated and I therefore went looking into making an alias for this command.


When opening ~/.bash_profile, I added the following line:


alias svn grab='svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add'


However, there are some single and double quotes in the original command, so the alias fails to be created (ok, it gets created partially, and I can't use it).


How do I escape the single quotes in the command, so the alias will work?





Aucun commentaire:

Enregistrer un commentaire