LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 07-13-2008, 03:35 AM   #1
MONKEYJUDO
LQ Newbie
 
Registered: Jul 2008
Posts: 8

Rep: Reputation: 0
unary operator expected


Hello,

I was running a smarttest on a drive and got this error.


smarttest: line 120: [: -ge: unary operator expected


Any Ideas what this means. Never seen this before. And google was no help on this one...

Thx
 
Old 07-13-2008, 06:05 AM   #2
rtg
Member
 
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Blog Entries: 3

Rep: Reputation: 19
Try running
smartctl -a $drive
where $drive is your hard drive, /dev/sda, /dev/hda or so. Then look for the bottom of the output:

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 136 -

If you have such line, then there is problem with this script not interpreting this correctly. If you don't, chances are that you haven't run SMART test on this hard drive previously. If this is the case, run

smartctl --test short $drive

And wait for about 3 minutes. You can see the progress of this test by running smartctl -a $drive, along the lines of

Self-test execution status: ( 241) Self-test routine in progress...
10% of test remaining.


After that, smarttest should be able to fill "$HOURS" variable inside the script.

Some bits of details:
The line looks like

if [ $HOURS -ge 26280 ]; then
...

With HOURS value missing it transforms into "if [ -ge 26280 ]; then ..." while -ge is not an unary operator, i.e. it accepts 2 arguments, while it is supplied only one.
 
  


Reply



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
Unary operator error hinetvenkat Programming 7 10-26-2008 11:22 AM
Binary operator expected - error mike9287 Linux - Newbie 9 07-17-2006 08:27 AM
Unary Operator expected. Bash script Blackout_08 Programming 2 06-22-2006 02:21 PM
wait_event_interruptible - invalid lvalue in unary `&' 7.e.Q Programming 4 11-08-2004 02:00 AM
Unary expressions loke137 Programming 1 08-17-2003 02:12 AM

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

All times are GMT -5. The time now is 07:34 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
Open Source Consulting | Domain Registration