Sh script under Linux syntax error near unexpected token `in error

2010-04-15  来源:本站原创  分类:OS  人气:273 

Today in the installation linux, when the sake of expedience, the direct use Dreamweaver to edit the configuration file, the results have been reported this error. To open in vi-b parameters found with the text at the end of each period of time will automatically add ^ M
History

long long ago.....  Old-fashioned teleprinter to start a new line characters to a carriage move back bit   ( Known as a carriage return  ,<CR>,ASCII Code  0D), Another character to move up one row   ( Known as line breaks  , <LF>,ASCII Code  0A). When the advent of the computer, memory was very expensive  . Some people assume there's no need to use two characters for EOL .UNIX developers decided that they can be used    A character to indicate the end of the line, Linux lineage  Unix, It is also  <LF>.Apple  Developers require the use of the  <CR>. MS-DOS and development  Windows  Of those guys you decided the old-fashioned  <CR><LF>.

 Because MS-DOS and  Windows Is carriage return + wrap to represent a new line  , Therefore on Linux with  Vim View used under Windows  VC Write code, after the end of the line  "^M" Symbols, represents a break  .

Solution:

1) vi-b back.sh

2)% s / ^ M / / g

/////// NOTE: The above command line in the "^ M" character, not "^" coupled with "M", but by "Ctrl + v", "Ctrl + M"

相关文章
  • Sh script under Linux syntax error near unexpected token `in error 2010-04-15

    Today in the installation linux, when the sake of expedience, the direct use Dreamweaver to edit the configuration file, the results have been reported this error. To open in vi-b parameters found with the text at the end of each period of time will

  • About error "syntax error near unexpected token` "and carriage return 2011-01-25

    To be a very simple thing, turn this thing is more interesting because of the typewriter ... ... http://blog.csdn.net/xyp84/archive/2009/08/11/4435899.aspx =============== ============ Calm dividing line Today, write a shell script to run properly on

  • cygwin shell syntax error near unexpected token 2010-04-15

    cygwin shell syntax error near unexpected token This is a common error and the reason is your are using Windows to create the file. Thus the line break is \ r \ n rather than \ n. All you need to do is change the format using a system command: dos2un

  • cocos2d-x编译android版本时出现"/bin/sh: -c: line 0: syntax error near unexpected token"错误 2014-02-12

    最新的cocos2d-x版本为2.1.3,在调用build_native.sh生成时没问题,但在build_native.sh clean时出现了以下错误. Clean:chipmunk_static[armeabi] /bin/sh:-c:line0:syntaxerrornearunexpectedtoken`(' /bin/sh:-c:line0:`rm-rf(TARGET_OBJS)' make:***[clean-chipmunk_static-armeabi]Error2 查了一下,

  • [To] build / envsetup.sh script shorthand 2011-05-30

    This switched: http://blogold.chinaunix.net/u/8866/showart_2384920.html Android101103 build / envsetup.sh notes for Android by ZCATT Email: [email protected] Blog http://zcatt.cublog.cn Abstract Document summarized the Android's build / envsetup.sh the c

  • Mysql automatic backup script under linux 2010-12-16

    The following is saved as a. Sh file and then put the above script files uploaded to the server, you can put linux directory as the executable file to modify the script command chmod + x filename; The first open system with vi cronntab: vi / etc / cr

  • Troubleshooting the RHCE exam, linux system can not boot or possible error conditions (change) 2010-03-19

    Troubleshooting the RHCE exam, linux system can not boot or possible error condition ############################################### # # ############################################### # # # # # Of: sheep ( [email protected] ) # # # Home: http://bluef

  • Fatal Error C1010: unexpected end of file while looking for precompiled header 2010-10-29

    Error Message unexpected end of file while looking for precompiled header. Did you forget to add '# include name' to your source? http://msdn.microsoft.com/en-us/library/d7fz9ckx (VS.80). aspx writes Error Message unexpected end of file while looking

  • hql unexpected token error solution [original] 2010-12-12

    String hql = "from TIssue where id in ('167 ', '169', '170 ', '171', '172 ', '173') and object = ', B01,'"; Sentence to run the program ~ inside Throw error: ERROR org.hibernate.hql.PARSER - line 1:26: unexpected token: object Until: String hql

  • Ubuntu execution time. Sh script 2011-08-15

    Svn in Ubuntu backup upload code to the backup file named svn_backup + the current time. Dump file (for example svn_backup20100525.dump) 1 script file (backup.sh) sudo touch backup.sh Create a script file, and edit documents sudo vim backup.sh The pi

  • "fatal error C1010: unexpected end of file"错误及其... 2012-04-24

    VC++项目中如果包含了.c文件或一般C++类的.cpp文件,编译时经常会碰到"fatal error C1010: unexpected end of file"的错误,VC6种的解决方法: 菜单--〉项目--〉设置...,出现"项目设置"对话框,左边展开项目,在"源文件"中找到出错的文件,然后在右边选择"C/C++"属性页,在Category下拉框中选择"Precompiled Headers",然后在

  • fatal error C1010: unexpected end of file while... 2013-01-20

    在编译VC++6.0是,出现fatal error C1010: unexpected end of file while looking for precompiled header directive 的错误. 解决方法: 1.如果发生错误的文件是由其他的C代码文件添加进入当前工程而引起的,则Alt+F7进入当前工程的 Settings,选择C/C++选项卡,从Category组合框中选中Precompiled Headers,选择Not Using Precompiled headers.

  • Install GD library error solution configure.ac: 64: error: possibly undefined macro: AM_ICONV 2011-03-23

    [Root @ xxt401 gd-2.0.35] # make install cd. & & / bin / sh / tmp/jpeg-6b/gd-2.0.35/config/missing-run aclocal-1.9-I config aclocal: configure.ac: 64: warning: macro `AM_ICONV 'not found in library cd. & & / bin / sh / tmp/jpeg-6b/gd-2.0.3

  • Android 1.5 Internal Error occurred in the eclipse error prevention solution 2010-06-26

    Android project today's inexplicable error, under the eclipse, and error type: ErrorLog displayed: Internal Error Java Model Exception: Java Model Status [gen [in HelloAndroid] does not exist] Problems in the show: Description Resource Path Location

  • keytool error: java.lang.RuntimeException: usage error, and not a lawful order 2010-08-02

    MD5 fingerprint for the time, discovered the problem: keytool error: java.lang.RuntimeException: usage error, and not a lawful order Error reason: keytool do not know the path with spaces The solution: to C: \ documents and settings \ administrator \

  • Error # 2044: Unhandled StatusEvent:. Level = error, code = 2011-05-04

    When using the LocalConnection, there Error # 2044: Unhandled StatusEvent:. level = error, code = This error used to be written directly in the timeline, no error. This is written in the document class. But how do all error For example. Test1.swf loa

  • IIS 7.0-hosted Web site error message: "HTTP Error 500.19 - Internal Server Error" 2011-05-30

    You have the Internet Information Services (IIS) 7.0 to host the site. When you visit Web browser, a Web site, you may receive one similar to the following error message: Error message 1 Application "application name" in the server error HTTP Er

  • Authentication token manipulation error 2011-06-28

    # Passwd Changing password for user root. New UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error 2 solutions chattr-i / etc / passwd chattr-i / etc / shadow # Passwd Changing password for user root. New UNIX pass

  • The sh script linux programming information 2010-03-22

    In Linux systems, although there are a variety of graphical interface tools, but the sell is still a very flexible tool. Shell is not just an order of the collection, and is a great programming language. You can use the shell to make a lot of task au

  • to achieve file transfer linux sh script 2010-08-24

    Goals: CN directory has a number of folders and each folder contains a series of CN at the beginning of the sub-folders are now required to CN at the beginning of implementation of these sub-folders are organized by folder name store, for example, /