Syntax Error Unexpected End Of File Bash
Bin bash declare i s declare i m declare i h if 3 50.
Syntax error unexpected end of file bash. Because windows uses a combination of two characters carriage return and line feed as line break in text files also known as crlf. I m simply trying to use a here doc for an ssh connection. Ask question asked 4 years 8 months ago. Active 2 years 9 months ago.
See bash 1 for more options histcontrol ignoreboth append to the history file don t overwrite it shopt s histappend for setting history length see histsize and histfilesize in bash 1 histsize 1000 histfilesize 2000 check the window size after each command and if necessary update the values of lines and columns. Unexpected end of file. Viewed 2k times 1. Using the bash that comes with windows 10 somehow the line endings had been changed to windows line endings crlf.
Then echo basename 0 setup. Changing the file back to use unix line endings solved the issue. Then s 3 50 m 2 1 h 1 else s 1 50 m 2 50. Unexpected end of file simple script.
Shopt s checkwinsize if set the pattern used in a pathname. Unexpected end of file. Ask question asked 8 years 2 months ago. You ve got an unclosed quote brace bracket if loop or something.
Convert eh line endings to unix endings and see if that solves the issue. Unexpected end of file bin. What does it mean. Then s 3 10 m 2 h 1 else if 2 50.
Stack exchange network consists of 176 q a communities including stack overflow the largest most trusted online community for developers to learn share their knowledge and build their careers. Echo dbg function help if 2 help setup. Bin sh connecttoserver ssh t root 1 endssh echo connected to server endssh connecttoserver 1 what s wrong with this code. Viewed 27k times 2.
There were a couple of things wrong with my script. If editing in vim enter the command set fileformat unix and save the file. If you can t see it just by looking i d recommend a syntax colouring editor and a neat indentation style take a copy of the script and delete half of it cutting it of somewhere that ought to be valid. I need some help for a very siple script i don t get were the fault is.
You are running a bash script and you see a syntax error. Active 8 years 2 months ago. This can happen if you create your script using windows.