• Home
  • Map
  • Email: mail@besthelp.duckdns.org

Unix syntax error near unexpected token elif

Ja( y), Nein( n) " read text if [ " $ text" - eq y ] ; then echo " Wilkommen zum Benutzererstellungsskript" # Username hinzufügen echo " Wie soll der Benutzer heissen? The shell really does not like those blanks between the brackets: if [ [ $ ARCH = = x86_ 64 ] ] ; then. It expects something like if [ [ $ ARCH = = x86_ 64 ] ] ; then. or ( better) if [ $ ARCH = x86_ 64 ] ; then. ( there is no point in making a. elif [ $ ver = = 7] ; then: version= " 1. 8" elif [ $ ver = = 8] ; then version= " 1. in the line elif [ $ ver = = 7] ; then: you have : after then which is caused the error. just delete the : and put space before each ] in conditions. You need to close both of your inner if- else statements with a fi. For example: if [ $ output2 = " Show" ] then echo showing files else echo hiding files fi. You also need a space before the closing ] in your if conditions. It' s your line endings. Transferring it from Windows has left the CR/ LF line endings on.

  • Postgresql syntax error at or near 1
  • Network error message list
  • Syntax error near unexpected token then in unix
  • Error correcting codes cryptography
  • Syntax error keyword row
  • Fatal error uncaught error class mongodb client not found in


  • Video:Unix error unexpected

    Unix elif unexpected

    When I create a script then manually add the CR characters, I get exactly the same error: qq. sh: line 3: syntax error near unexpected token. You need a semi- colon after if [. ] and before then, and the same with elif : if [ " $ 1" = = " this_ script" ] ; then # ^ # here! # v elif [ " $ 1" = = " other_ script" ] ; then. From Bash manual - 3. 2 Conditional Constructs: The syntax of the if. なんの話かというと、 その14時頃に遭遇していた問題というのがあって、 ターミナル を開くと - bash: / Users/ note103/. bash: line 52: syntax error near unexpected token ` elif' - bash:. First of all, do not tag it bash and sh, you have one shell, type echo $ SHELL to know which shell you use, or put a shebang at the start of your script ( #!

    / usr/ bin/ env bash ). put semicolons after your commands, including [. The garbled error message indicates your file has carriage returns before the newline. Did you edit your script on Windows? If you are using vi editor, set " : set ff= unix", save the file, and re- execute it. This file format ( ff) set.