Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, this. Plus a mistake from the article:

  $ echo '*\n!.gitignore' > build/.gitignore
The \n won't be interpreted specially by echo unless it gets the -e option.

Personally if I need a build directory I just have it mkdir itself in my Makefile and rm -rf it in `make clean`. With the article's scheme this would cause `git status` noise that a `/build/` line in a root .gitignore wouldn't. I'm not really sure there's a good tradeoff there.

 help



> The \n won't be interpreted specially by echo unless it gets the -e option.

Author's probably using Zsh, which interprets them by default.


If you want any kind of non-trivial formatting, use the printf command, not echo.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: