Bash_profile Line 13 Syntax Error Unexpected End Of File
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings .bashrc line syntax error unexpected end of file and policies of this site About Us Learn more about Stack Overflow
Syntax Error Unexpected End Of File Bash
the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation bash syntax checker Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it
Unexpected Eof While Looking For Matching `"'
only takes a minute: Sign up .profile: line 31: syntax error: unexpected end of file up vote 2 down vote favorite I'm bad at bash programming. Where is the error? Here is my .profile file: # WARNING: For help understanding this file, and before you try # to change any of it, type "man .profile" and read carefully. # # bashrc example # Set command search rules # if [ -x /bin/showpath ] ; then export PATH; PATH=`/bin/showpath $HOME/bin /u/cs350/sys161/bin /software/gnu/bin standard` export PATH; PATH=`/bin/showpath usedby=user standard $HOME/bin` # # Find out what kind of terminal we are using # eval `setterm sytek:kd404 default:vc404` # # Set terminal-type dependent options (e.g. sysline or prompt string) # #HOMEHOST="
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us
Bash Command Not Found
Learn more about Stack Overflow the company Business Learn more about hiring developers
Dos2unix
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Bash syntax error: unexpected end of file up http://stackoverflow.com/questions/3869636/profile-line-31-syntax-error-unexpected-end-of-file vote 29 down vote favorite 14 Forgive me for this is a very simple script in Bash. Here's the code: #!/bin/bash # june 2011 if [ $# -lt 3 -o $# -gt 3 ]; then echo "Error... Usage: $0 host database username" exit 0 fi after running sh file.sh: syntax error: unexpected end of file bash syntax share|improve this question edited Jun 17 '13 at 10:26 fedorqui http://stackoverflow.com/questions/6366530/bash-syntax-error-unexpected-end-of-file 108k30164211 asked Jun 16 '11 at 2:34 markcruz 174127 add a comment| 9 Answers 9 active oldest votes up vote 41 down vote accepted I think file.sh is with CRLF line terminators. run dos2unix file.sh then the problem will be fixed. You can install dos2unix in ubuntu with this: sudo apt-get install dos2unix share|improve this answer answered Jun 16 '11 at 2:50 clyfish 4,98311822 thanks guys! all of you are right. there's something non-unix character embedded on my code! thanks –markcruz Jun 16 '11 at 2:54 thanks! saved me a lot of time! surprised I need to google this many pages before running into this answer. –Derek Jul 3 '13 at 6:01 Whats the reason behind this problem? I usually work on Windows but need to transfer scripts to unix systems. –CMCDragonkai Nov 2 '13 at 16:06 3 Makes no change for me. Downvoting. Sorry. –Kees de Kooter Dec 5 '14 at 8:35 2 @KeesdeKooter I wouldn't say just because something didn't work for you that you should downvote it, clearly it worked for the 28 upvotes. A simple it didn't work for me suffices. That's why SO allowed multiple answer
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 answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about http://askubuntu.com/questions/145900/syntax-error-unexpected-end-of-file-simple-script Stack Overflow the company Business Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 top “syntax error: unexpected syntax error end of file” simple script up vote 1 down vote favorite i need some help for a very siple script, i don't get were the fault is. The script : #!/bin/bash declare -i s declare -i m declare -i h if [ "$3" < 50 ]; then s=$3+10 m=$2 h=$1 else if ["$2" < 50 ]; then s=$3-50 m=$2+1 h=$1 else s=$1-50 m=$2-50 h=$1+1 fi fi echo "$h:$m:$s" The script add 10sc syntax error unexpected to the time we've entered. I get this error message : "sub_change_dirrect: line 14: syntax error: unexpected end of file" bash scripts share|improve this question edited Jun 3 '12 at 12:54 adempewolff 5,60011943 asked Jun 3 '12 at 12:41 Sam 4444915 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted There are three obvious errors: On the line else s=$1-50 m=$2-50 h=$1+1 fi, the word fi is not treated as a keyword, because it is not the first word in the command. To the shell, this looks like three assignments that apply to the command fi. If you ever got to execute this line, you'd see an error bash: fi: command not found. Put fi on a line of its own (or put a ; before it). [ "$3" < 50 ] is the same as [ "$3" ] < 50 — it's the command [ … ] (which can also be written test) with the sole argument "$3", and with an input redirection from the file 50. Either use the numeric comparison operator -lt, or use an arithmetic instruction (( … )). The single bracket construct is an ordinary built-in command, so special characters such as < retain their normal meaning. The double parenthesis construct is special syntax, and