Shell script issue

Below is my script. However when i run it, i get the below error

./dummy.sh: line 27: syntax error: unexpected end of file
#!/bin/bash
while :
do
read -r INPUT_STRING
case $INPUT_STRING in
        test)
               echo "Please enter id no : "
                                read -r input_variable
                                if [[ ${#input_variable} -ne "7" ]]
                                then
                                echo "Please check the id no given"
                                exit 1
                                fi
                                HOST=xxx
                                USER=xxx
                                PASSWORD=xxx
                                ^Iftp -inv $HOST <<- EOF
                                user $USER $PASSWORD
                                cd /work/path//$input_variable/to/destination/
                                mput x.csv
                                
^IEOF
;;
esac

Please show the entire script. There's no line 27 in the snippet you posted. (Although one can infer it's the last line).
Are those ^I real text or artefacts (from posting)?

Well isn't that the problem? The here doc ( <<- EOF ) cannot find EOF, because there is a control character ( ^I )in front of it.

There is another control character before "ftp"

--
Moved thread to right forum

A here doc introduced by <<- looks for the word with leading <TAB> chars, which are represented by the ^I in e.g. cat -T .
So - if the ^I are real text, you are right, EOF is not found. If they are <TAB>s incorrectly displayed by the posting, the EOF should be found and we need to look elsewhere.

1 Like

You're right ^I may represent what once was a TAB character...