My latest iteration
jinit= !git init && printf "* text=auto\n*.java text\n*.jsp text\n*.css text\n*.html text\n*.js text\n*.xml text\n*.sql text\n*.MF text\n*.tld text\n*.md text\n\n# git files\n*.gitignore text\n*.gitattributes text\n\n# eclipse files\n*.classpath text\n*.project text\n*.prefs text\n*.properties text\n*.component text\n" >> .gitattributes && echo "bin/" >> .gitignore && git add .
This will actually try to execute the lines in gitattributes ! Changing \n
for \r\n
will crash the script and for \\\n
will successfully run the script albeit the gitattributes will only contain
*
So how do I echo this with new lines ? Windows, mingwin, msysgit
EDIT : I also tried single quotes
EDIT 2014.03.13:
jinit= !git init && `echo '* text=auto\n\n*.java text\n*.jsp text\n\
*.css text\n*.html text\n*.js text\n*.xml text\n*.sql text\n*.MF text\n\
*.tld text\n*.md text\n\n*.gitignore text\n*.gitattributes text\n\n\
*.classpath text\n*.project text\n*.prefs text\n*.properties text\n\
*.component text\n' >> .gitattributes` && `echo "bin/" >> .gitignore`
EDIT 2014.03.14: using \
to wrap the command - still works but a space is introduced before *.css, *.tld, *.classpath and *.component.
Can't seem to manage echoing comments. So if I add \n# git files\n\*.gitignore text\n (...)
it EOFs - any workaround for that ?
Finally I used a different approach (see comments):
jinit= !git init\
&& `ln /c/Dropbox/_/_git/java_eclipse.gitattributes .gitattributes`\
&& `echo "bin/" >> .gitignore`\
&& git add .
but I leave this open for now, for the syntactic part
jinit= `echo '* text=auto\n\n# comment`
– Andersen