Last day I wrote a script so that my J2ee app could do backups. After deployment, the script was not working. I was wondering why, so I copied it from the deployment directory to my home dir. It was not even executing the first echo
. That was strange because I tested the script on the very same machine. Later, after another SO question, I discovered that passing it through dos2unix would solve the problem. What happened was that I wrote the script on Linux, I did a simple copy and paste on Eclipse (running on windows), then I deployed the application (and the script was with /n/r the windows way).
How can I avoid this? I mean, I should write the script on Linux and not开发者_开发知识库 touch it at all (I'd like to have other options), or is there some special setting I could use?
You can set Eclipse to use Unix line-endings. http://www.sics.se/node/2108
Navigate to the Workspace preferences (General:Workspace) Change the Text File Encoding to UTF-8 Change the New Text File Line Delimiter to Other and choose Unix from the pick-list Note: to convert the line endings of an existing file, open the file in Eclipse and choose File : Convert Line Delimiters to : Unix
精彩评论