私の最新のイテレーション
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 .
これは実際に gitattributes の行を実行しようとします! \n
forを変更する\r\n
とスクリプトがクラッシュし、 for はスクリプト\\\n
を正常に実行しますが、gitattributes のみが含まれます
*
では、これを新しい行でエコーするにはどうすればよいですか? Windows、mingwin、msysgit
編集:一重引用符も試しました
編集 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`
編集 2014.03.14 :\
コマンドをラップするために使用 - まだ機能しますが、*.css、*.tld、*.classpath、および *.component の前にスペースが導入されます。
エコーコメントを管理できないようです。それで、EOFを追加する\n# git files\n\*.gitignore text\n (...)
と、その回避策はありますか?
最後に、別のアプローチを使用しました(コメントを参照):
jinit= !git init\
&& `ln /c/Dropbox/_/_git/java_eclipse.gitattributes .gitattributes`\
&& `echo "bin/" >> .gitignore`\
&& git add .
しかし、構文部分のために、今のところこれを開いたままにします