LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-16-2011, 06:52 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 36
Error executing the script.


Running following script for checking root ssh login status.
Code:
Flag=`cat  /etc/ssh/sshd_config | grep "^PermitRootLogin"`
if [ -z "$Flag" ]
then
echo "PermitRootLogin is not yet set"
else
echo "$Flag"
YESNOFlag=`echo $Flag|awk '{print $2}'`

if [ "$YESNOFlag" == "yes" ]
then
echo "Root Login Is Enabled"
elif [ "$YESNOFlag" == "no" ]
then
echo "Root Login Is Disabled"
else
echo "Unable to Determine the value"
fi
However i m getting below error.
Code:
# test.sh
/usr/local/sbin/test.sh: line 18: syntax error: unexpected end of file


---------- Post added 06-16-11 at 05:53 AM ----------

Figured out myself sorry for inconvenience.
 
Old 06-16-2011, 11:11 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
It might be nice to mention what the problem was, as a help to anyone else who comes across this in the future. "unexpected end of file" usually means there's a command that's missing its closing. And I do indeed see that there's a missing "fi".

Use of a consistent indentation scheme would help with reading/debugging and can help in catching errors like this.

Also, $(..) is highly recommended over `..`.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Error Executing the script. pinga123 Linux - Newbie 6 07-20-2010 02:32 PM
[SOLVED] Error Executing a script(SSH problem) pinga123 Linux - Newbie 5 07-14-2010 01:54 PM
[SOLVED] Error Executing the script. pinga123 Linux - Newbie 3 07-08-2010 11:34 PM
Error executing Perl/CGI script loftus49 Fedora 6 06-10-2010 04:41 AM
Executing PHP script- error message vfulco Linux - Newbie 3 07-13-2004 11:55 PM


All times are GMT -5. The time now is 05:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration