LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 08-07-2010, 08:45 AM   #16
fusion1275
Member
 
Registered: Jul 2007
Location: Portsmouth, Hants
Distribution: Linux Mint
Posts: 274

Original Poster
Rep: Reputation: 35

And with the double == as recommended...

Quote:
+ set -x
+ date +%Y/%m/%d
+ DATE=2010/08/07
+ date
+ awk {print $4}
+ TIME=13:43:34
+ RMT_HOST=www.google.co.uk
+ COUNT=1
+ ping -c 1 www.google.co.uk
+ grep icmp_seq=1
+ PING=64 bytes from 173.194.36.104: icmp_seq=1 ttl=57 time=53.0 ms
+ [ 64 bytes from 173.194.36.104: icmp_seq=1 ttl=57 time=53.0 ms == ]
[: 1: bytes: unexpected operator
 
Old 08-07-2010, 08:50 AM   #17
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,254

Rep: Reputation: 314Reputation: 314Reputation: 314Reputation: 314
You must doublequote "${PING}". Without it, it is threated as command.
 
Old 08-07-2010, 09:12 AM   #18
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
did you try "bash <script>" as I suggested before just to make sure. If so and it still gets the error try the line "echo ${PING}" before the if statement, see what it outputs... it might be time for that type of debugging.
 
Old 08-07-2010, 09:13 AM   #19
fusion1275
Member
 
Registered: Jul 2007
Location: Portsmouth, Hants
Distribution: Linux Mint
Posts: 274

Original Poster
Rep: Reputation: 35
Well I have walked away from this, made a cup of coffee, come back with a fairly fresh pair of eyes and the code is now working as it should.

I have no idea why it wasnt working 10mins ago. But now its alive.

Anyway...

Thank you all for you help. Im sorry if I have caused some brain ache

Take care and keep up the good job!!
 
Old 08-07-2010, 09:15 AM   #20
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
This sounds strange. My latest suspicion was that ${PING} was returning a null value causing the issue... but if it works now I guess it can't be tested. if it seems fixed do you mind just marking the thread as solved.
 
  


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
Spam reporting script was working now fails Toadman Programming 8 12-09-2009 11:25 AM
SMB Error : Kernal Reporting smb_get_length: Invalid NBT packet ,code=fd ukn_linux Linux - Newbie 1 05-10-2008 04:49 PM
LXer: UNIX error reporting in the standard C library LXer Syndicated Linux News 0 09-08-2006 05:33 AM
Error reporting in c george_mercury Programming 2 11-20-2004 07:22 PM
mail log reporting error every minute kwingate Fedora 0 10-25-2004 10:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:44 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