Home > Unexpected End > Unexpected End Of File Error In Unix Shell Script

Unexpected End Of File Error In Unix Shell Script

Contents

How do I handle an unterminated wire behind my wall? I used heredoc inside an if block. or recreate the script in linux iteself. Why is the size of my email so much bigger than the size of its attached files? check over here

Number does not equal 1 As you can see, bash displayed an error message when we ran the script. Password Programming This forum is for all programming questions. Please use the new version at LinuxCommand.org LinuxCommand Learningtheshell Writingshellscripts Script library SuperMan pages Who, What, Where, Why Tips, News And Rants Previous | Contents | Next Stay Out Of Trouble more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation http://unix.stackexchange.com/questions/193165/syntax-error-unexpected-end-of-file-bash-script

Syntax Error Unexpected End Of File Bash

You are currently viewing LQ as a guest. Try changing it to #!/bin/bash catkin View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by catkin View Blog 04-29-2010, 12:43 PM #7 Code: cat -vet script_name shamrock View Public Profile Find all posts by shamrock #4 07-02-2008 alias_juju Registered User Join Date: Jul 2008 Last Activity: 3 To do this, create the following script called trouble.bash.

This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. up vote 3 down vote favorite I can't normally run sh scripts. Is it dangerous to use default router admin passwords if only trusted users are allowed on the network? Syntax Error Near Unexpected Token `fi' Die Liebe höret nimmer auf Enable Wireless on Fresh Debian Build Why don't miners get boiled to death at 4 km deep?

Keep adding :) –Shobhit Puri May 14 '15 at 23:07 add a comment| up vote 6 down vote In my case, I found that placing a here document (like sqplus ... Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... linux operating commands and unix operating commands syntax error: unexpected You will often find that a portion of your program will fail because something that you assumed was correct earlier in your program is, in fact, incorrect and is causing your useful reference Player claims their wizard character knows everything (from books).

Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the Delimited By End-of-file (wanted `eof') Commit complete. command-line bash scripts share|improve this question edited Sep 3 '13 at 21:57 Braiam 39.2k1693154 asked Sep 3 '13 at 8:29 user568021 2952619 How do you run the above script? I have simplified my code majorly and still get the same error so there's obviously something wrong with my basic syntax. #usr/bin/sh if [$1 -lt $2]; then echo "done" else echo

  • Please see the output below: $ ./a.sh ./a.sh: 3: ./a.sh: Host: not found ./a.sh: 4: ./a.sh: Port: not found Usage: ping [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface] [-m mark] [-M
  • Reason: Please use codetags to maintain spacing/indenting Remove advertisements Sponsored Links boopathyvasagam View Public Profile Find all posts by boopathyvasagam #2 07-28-2010 pravin27 Advisor
  • For example.: #!/bin/bash number=1 set -x if [ $number = "1" ]; then echo "Number equals 1" else echo "Number does not equal 1" fi set +x Previous | Contents |
  • very lightweight low power microcontroller with memory?
  • Why cast an A-lister for Groot?
  • TNG Season 5 Episode 15 - Is the O'Brien newborn child possessed, and is this event ever revisited/resolved/debunked?

Bash Unexpected End Of File While Looking For Matching

SXA Page Design vs Page Standard Values vs Page Branch Template Why were Navajo code talkers used during WW2? http://www.linuxquestions.org/questions/programming-9/shell-scripting-syntax-error-unexpected-end-of-file-804990/ Last edited by Scott; 07-28-2010 at 05:23 PM.. Syntax Error Unexpected End Of File Bash Is Certificate validation done completely local? Syntax Error Unexpected End Of Input Thanks! –user55570 Jun 17 '15 at 22:35 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign

It's confusing. http://centralpedia.com/unexpected-end/unexpected-end-of-file-error-php.html Thank you in advance .. Are assignments in the condition part of conditionals a bad practice? If that's the case dos2ux should fix that. Shell Script Validator

Unix & Linux Stack Exchange works best with JavaScript enabled current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. coming in .... ' echo 'I can not get this simple statement to execute I can not get this simple statement to execute dummy_g5.sh: line 8: syntax error: unexpected end of Otherwise, parameter and command substitution occur, \NEWLINE is ignored, and \ must be used to quote the characters \, $, `, and the first character of word. this content Linux is a registered trademark of Linus Torvalds.

A common problem will be that you will make a false assumption about the performance of your program. Syntax Error Unexpected End Of File Python So fi is a command, the spaces are important, and [] is used for char/strings. Than it work fine –shubham kumar Mishra Feb 12 '15 at 11:51 add a comment| up vote 0 down vote I have found that this is sometimes caused by running a

Every polynomial with real coefficients is the sum of cubes of three polynomials How to apply for UK visit visa after four refusal What does this ice key do? "Full-time Employment

It felt so wrong to have un-indented code in the block, but it's absolutely necessary. –Zeal Jul 6 at 17:50 add a comment| up vote 2 down vote echo"==================PS COMMAND SNAPSHOT==============================================================" Strange device identification How to create a custom theme in SXA? Then, the shell complains that it reaches the end of the script file without finding a then following the if (there's just a then). Syntax Error Near Unexpected Token `done' See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question. (0)

Use dos2unix or d2u, or issue a :set ff=unix in vim to fix your script file. What was that alien in Doctor Who that nobody saw? Disproving Euler proposition by brute force in C What do you call someone without a nationality? http://centralpedia.com/unexpected-end/unexpected-end-of-file-error.html Lengthwise or widthwise.

To do this, add a "-x" to the first line of your script, like this: #!/bin/bash -x Now, when you run your script, bash will display each line (with substitutions performed) To understand this error, we have to see what the shell sees. It also explains the rest of the error message we received. Browse other questions tagged bash shell-script or ask your own question.

What are the large round dark "holes" in this NASA Hubble image of the Crab Nebula? You can confirm the validity of this by trying it on the command line: [[email protected] me]$ number= [[email protected] me]$ See, no error message. You will sometimes want to set a variable's value to nothing. For example this scripts works ok: echo "hello" it prints "hello" with no errors.

There are two kinds of messages that you should insert. Clean up your code, and errors start to stand out. The question does not have to be directly related to Linux and any language is fair game. I also find that text editors with syntax highlighting (like nedit or kate) make these kinds of bugs easier to find.

Why were Navajo code talkers used during WW2? This site is not affiliated with Linus Torvalds or The Open Group in any way. Thanks again for your help roxie600 View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by roxie600 04-30-2010, 12:18 AM #13 grail LQ Set "execute" permissions (by running "chmod +rx tmp.sh") 5.