cygwin的bash错误:$'\r': command not found 及unexpected end of file 的错误

原因主要是因为 cygwin/home/admin 的工作目录下的几个配置文件,都是dos格式的,尤其是末尾的回车换行("\n\r"),而应该是unix的,只要个回车("\n")。因此,下载一个dos2unix命令包,解压安装在该工作目录下,运行如下命令:

cd

dos2unix  .bashrc

dos2unix  .inputrc

dos2unix  .bash_profile

dos2unix  /etc/bash.bashrc

再重新运行cygwin命令窗口,bush错误消失了!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Shell scripting is a way to harness and customize the power of any Unix system, and an essential skill for Unix users, system administrators, and even professional Mac OS X developers. But beneath this simple promise lies a treacherous ocean of variations in Unix commands and standards. This thoroughly revised edition of bash Cookbook teaches shell scripting the way Unix masters practice the craft. Three Unix veterans present a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell—the bash shell—and cygwin or other popular Unix emulation packages. This cookbook is full of useful scripts that readers can use right away, along with examples that explain how to create better scripts. Table of Contents Chapter 1. Beginning Bash Chapter 2. Standard Output Chapter 3. Standard Input Chapter 4. Executing Commands Chapter 5. Basic Scripting: Shell Variables Chapter 6. Shell Logic And Arithmetic Chapter 7. Intermediate Shell Tools I Chapter 8. Intermediate Shell Tools Ii Chapter 9. Finding Files: Find, Locate, Slocate Chapter 10. Additional Features For Scripting Chapter 11. Working With Dates And Times Chapter 12. End-User Tasks As Shell Scripts Chapter 13. Parsing And Similar Tasks Chapter 14. Writing Secure Shell Scripts Chapter 15. Advanced Scripting Chapter 16. Configuring And Customizing Bash Chapter 17. Housekeeping And Administrative Tasks Chapter 18. Working Faster By Typing Less Chapter 19. Tips And Traps: Common Goofs For Novices Appendix A Reference Lists Appendix B Examples Included With Bash Appendix C Command-Line Processing Appendix D Revision Control

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值