Number does not equal 1 As you can see, bash displayed an error message when we ran the script. 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 ... My first comment would be that you should change: Code: echo $returned to: Code: echo "$returned" or better yet (removing problems that could be caused depending on the contents of SapLogs.log): more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed http://mmonoplayer.com/syntax-error/syntax-error-near-unexpected-token-bash-function.html
And yes it's what I want the script to do, not to get the present time + 10sc. The second type displays the value of a variable (or variables) used in a calculation or test. I used heredoc inside an if block. All Rights Reserved.
The ! Finding the desired way later means double work in such spaghetti code. I don't see why the following would make any difference in the behavior of your script (except that if there are multiple errors found, they will be printed on separate lines; Java Syntax Error: End Of File Unexpected (expecting ")") From this we can determine that the error is occurring on line 5 not line 3.
So, I think you can get your script to work if you write this into a new file (let's call it newscript): Code: #!/bin/bash echo "=== Checking logs ===" tail -50 Obviously, it's more different then coding then I thought. Frequently, you will do this to a block of code to see if a particular problem goes away. nc -z $Host $Port; then (or nc -z $Host $Port; result_nc=$?
And remove the spaces in the assignment: Host = ############### Port = #### so that becomes: Host=############### Port=#### because assignments will not work properly if there are spaces. Syntax Error Near Unexpected Token `fi' Linux Forum XenForo style by Pixel Exit UNIX & Linux Forums > Top Forums > Shell Programming and Scripting Member Name Remember Me? asked 4 years ago viewed 14439 times active 4 years ago Related 0Bash script throws “syntax error near unexpected token `}'” when run0line 45 Syntax error: unexpected end of file0Syntax Error: To the shell, this looks like three assignments that apply to the command fi.
Resubmitting elsewhere without any key change when a paper is rejected Understanding the grammar: «illis Evangelii nuntiandi praebens mandatum» What are the ground and flight requirements for high performance endorsement? I'll also recommend shellcheck.net for basic sanity-checking. –Gordon Davisson Jun 17 '15 at 6:25 Updated the answers. Syntax Error: Unexpected End Of File Bash How to decrypt .lock files from ransomeware on Windows How many times do you need to beat mom and Satan etc to 100% the game? Syntax Error Unexpected End Of Input I meant : elif (( $2 < 59 )); then s=$3-50 m=$2+1 h=$1 else s=$3-50 m=0 h=$1+1 fi –Sam Jun 3 '12 at 18:40 add a comment| up vote 0 down
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) http://mmonoplayer.com/syntax-error/syntax-error-near-unexpected-token-elif-39-bash.html Fixed by running dos2unix on the script, with proper description of problem and solution given in that answer share|improve this answer answered Feb 6 '15 at 9:47 shtolik 426922 add a How do I reassure myself that I am a worthy candidate for a tenure-track position, when department would likely have interviewed me even if I wasn't? share|improve this answer answered Nov 9 at 7:10 Mahesh Gareja 798 I had that added, but when executing shell it gave error "not found" and when i removed it Syntax Error At Line (' Unexpected
Not the answer you're looking for? How many times do you need to beat mom and Satan etc to 100% the game? Forum Operations by The UNIX and Linux Forums weblink the sum of consecutive odd numbers Complimenting the author of a textbook A pilot's messages Why would a NES game use an undocumented 1-byte or 2-byte NOP in production?
If you don't get the expected output, check your typing; you made a mistake. Shell Script Validator share|improve this answer edited Mar 27 '12 at 12:54 answered Mar 27 '12 at 9:27 user unknown 21.1k74292 add a comment| up vote 1 down vote You've got an unclosed quote, Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... learn linux and unix commands - unix shell scripting IF
Should a country name in a country selection list be the country's local name? In 5e, do you get to use the extra attack as well when you ready an attack action? Not the answer you're looking for? Unexpected Eof While Looking For Matching `"' Log in with Facebook Your name or email address: Do you already have an account?
Outlet w/3 neutrals, 3 hots, 1 ground? Why would a NES game use an undocumented 1-byte or 2-byte NOP in production? Idiomatic Expression that basically says "What's bad for you is good for me" Change syntax of macro, to go inside braces Word that includes "food, alcoholic drinks, and non-alcoholic drinks"? Regards, Adrian Remove advertisements Sponsored Links jedzio View Public Profile Find all posts by jedzio #2 07-31-2014 Don Cragun Administrator Join Date: Jul 2012
For clarity when reading a script, I don't usually use: Code: if ! Repeat until you've narrowed down the problem. How secure is a fingerprint sensor versus a standard password? more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed