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
LinuxShell ScriptingScripting LanguagesLinux OS Dev

Avatar of undefined
Last Comment
Enhance Technology
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.
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

You’re missing the “done” statement. Add a line 8 containing just “done “.
Avatar of serialband
serialband
Flag of Ukraine image

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
Avatar of arnold
arnold
Flag of United States of America image

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.
Avatar of serialband
serialband
Flag of Ukraine image

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Enhance Technology

ASKER

Thanks Experts...
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo