Link to home
Start Free TrialLog in
Avatar of Enhance Technology
Enhance TechnologyFlag for India

asked on

Syntax error: unexpected end of file

Hello Experts,
I am getting error while execute script from Linux system...

[root@119 bin]# ./BOD.sh
./BOD: -c: line 7: syntax error: unexpected end of file

Script:-
[root@119 bin]# vim BOD.sh
   1 #!/bin/bash
  2 export DISPLAY=:1
  3 cat /root/version.txt |  while read output
  4 do
  5 gnome-terminal \
  6         --tab -t "SMM" -e " sh -c 'sleep 10s; ./startapp SMM' "\

[root@119 ~]# cat version.txt
cd /home/rajat/Desktop/Symbol_4.1.1.1_0812
Avatar of arnold
arnold
Flag of United States of America image

You are missing the "done" to terminate the while ...; do loop
Line 7 leave blank
line 8 done

Should solve the end of file error.
You’re missing the “done” statement. Add a line 8 containing just “done “.
You have a backslash at the end of line 6.  The backslash indicates that there will be a continuation on the next line.  That's why there's an error about line 7, if you don't have a line 7.  If that's not what you meant, then you should remove it.

 6         --tab -t "SMM" -e " sh -c 'sleep 10s; ./startapp SMM' "\
Avatar of Enhance Technology

ASKER

Now following script is ok for execute. After execution this script not execute from mention path...
path :- cd /home/rajat/Desktop/Symbol_4.1.1.1_0812

executing from:- /home/rajat

why it is happning ?


[root@119 bin]# ./BOD.sh

Script:-
[root@119 bin]# vim BOD.sh
  1 #!/bin/bash
  2 export DISPLAY=:1
  3 cat /home/rajat/Desktop/version.txt |  while read output
  4 do
  5 gnome-terminal \
  6         --tab -t "SMM" -e " sh -c 'sleep 10s; ./startapp SMM' "\
  7
  8 done

   
[rajat@119 Desktop]$ cat version.txt
cd /home/rajat/Desktop/Symbol_4.1.1.1_0812
You can not declare DISPLAY AS IT HAS A special meaning and will be setup when the incoming connection includes an X11 tunnel and this server supports x11forwarding in sshd_config.
If you don't understand how DISPLAY is used, then you shouldn't be changing it yourself.  You should also remove that backslash at the end of line 6, rather than adding a blank line for no good reason.
ASKER CERTIFIED SOLUTION
Avatar of Enhance Technology
Enhance Technology
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Experts...