Enhance Technology
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_0 812
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
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' "\
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_0 812
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/versio n.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_0 812
path :- cd /home/rajat/Desktop/Symbol
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/versio
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Experts...
Line 7 leave blank
line 8 done
Should solve the end of file error.